-
Notifications
You must be signed in to change notification settings - Fork 345
Improve: データ準備を高速化 #2090
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve: データ準備を高速化 #2090
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
良いですね!!!ぜひ実装したいです!!
asyncになっちゃうんですね。そこ周りでちょっとコメントを書きました。
asyncComputedの実装がちょっとややこしいかもです。
(実際にはcomputedではなく、どちらかというとwatchして値を返す感じ)
提案としては、利用箇所がエンジンのアイコン取得部分だけなのと、そのコードが3箇所にコピペされているので、むしろこっちを便利関数にするのはどうでしょう。
こんな感じを想像してます。
type RefLike<T> = Ref<T> | ComputedRef<T>
const useEngineIcons = (engineManifests: RefLike<Record<EngineId, EngineManifest>>) => {
const engineIcons = ref<Record<EngineId, string>>({});
watch(
engineManifests,
async (engineManifests) => {
for (const [engineId, manifest] of Object.entries(engineManifests)) {
engineIcons.value[EngineId(engineId)] = await base64ImageToUri(manifest.icon);
}
},
{
immediate: true,
},
);
return engineIcons;
};Object.entries(engineManifests)).mapでpromiseリスト作ってPromise.allして非同期にしても良いかも。
|
useEngineIconsにまとめるようにしました。 |
|
これで大丈夫のはず? |
Hiroshiba
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!!
起動が早くなったのめちゃくちゃいいですね!!
|
@sevenc-nanashi ちょっと突発的ご相談が・・・! ニーズのある機能が実装されたときにSNSで言及しておりまして、今回のプルリクエストもツイートしたいと思っています。 (RTされたりリプライで届く感謝の言葉をお届けできればという意図と、あと開発者が分かるので新規コミッターの方がOSS開発に興味を持ってくださる導線を増やせればという意図があります・・・!) こんな感じを予定しています・・・! |
|
大丈夫ですー。次に大きな機能実装したときもツイートは別に許可なしで大丈夫です、 |
|
承知しました! ツイートさせていただきました!! |
内容
ことで高速化します。
関連 Issue
スクリーンショット・動画など
compare.mp4
その他
(なし)