Skip to content

Commit b1875cb

Browse files
committed
fix(web): fix unsafe store access in use-list-scroll
1 parent b1fc246 commit b1875cb

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/components/common/list/use-list-scroll.ts

+10-5
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,17 @@ export const getProgressQuery = (item: ListScrollSourceItem): ListScrollItem['ge
9292
});
9393
};
9494

95-
const i18n = useI18n('common');
95+
let i18n: ReturnType<typeof useI18n>;
9696

97-
const i18nEpisode = () => i18n('episode', 'common', 'tag');
98-
const i18nSeason = () => i18n('season', 'common', 'tag');
99-
const openInEpisode = () => i18n('open_episode_in_trakt', 'common', 'tooltip');
100-
const openInSeason = () => i18n('open_season_in_trakt', 'common', 'tooltip');
97+
const getI18n = () => {
98+
if (!i18n) i18n = useI18n('common');
99+
return i18n;
100+
};
101+
102+
const i18nEpisode = () => getI18n()('episode', 'common', 'tag');
103+
const i18nSeason = () => getI18n()('season', 'common', 'tag');
104+
const openInEpisode = () => getI18n()('open_episode_in_trakt', 'common', 'tooltip');
105+
const openInSeason = () => getI18n()('open_season_in_trakt', 'common', 'tooltip');
101106

102107
const getEpisodeTypeTag = (episode: ListScrollSourceItem['episode']): ListScrollItemTag | undefined => {
103108
if (!episode) return;

src/web/init-services.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,11 @@ export const initServices = async () => {
6262
useExtensionSettingsStore().initExtensionSettingsStore(),
6363
]);
6464

65+
await initLocalI18n().promise;
66+
6567
await useActivityStore().initActivityStore();
6668

6769
await Promise.all([
68-
initLocalI18n().promise,
6970
syncRestoreAllUsers(),
7071
useImageStore().initImageStore(),
7172
useListsStore().initListsStore(),

0 commit comments

Comments
 (0)