improve performance by avoiding some big re-renders (#1087)

This commit is contained in:
Athou
2025-05-26 20:53:11 +02:00
parent 91857c4d73
commit c7cec464aa
3 changed files with 19 additions and 17 deletions

View File

@@ -8,28 +8,28 @@ interface Step {
}
export const useAppLoading = () => {
const profile = useAppSelector(state => state.user.profile)
const settings = useAppSelector(state => state.user.settings)
const rootCategory = useAppSelector(state => state.tree.rootCategory)
const tags = useAppSelector(state => state.user.tags)
const profileLoaded = useAppSelector(state => !!state.user.profile)
const settingsLoaded = useAppSelector(state => !!state.user.settings)
const rootCategoryLoaded = useAppSelector(state => !!state.tree.rootCategory)
const tagsLoaded = useAppSelector(state => !!state.user.tags)
const { _ } = useLingui()
const steps: Step[] = [
{
label: _(msg`Loading settings...`),
done: !!settings,
done: settingsLoaded,
},
{
label: _(msg`Loading profile...`),
done: !!profile,
done: profileLoaded,
},
{
label: _(msg`Loading subscriptions...`),
done: !!rootCategory,
done: rootCategoryLoaded,
},
{
label: _(msg`Loading tags...`),
done: !!tags,
done: tagsLoaded,
},
]