Refactor personal account components for data fetching efficiency

Refactored personal account components to centralize user data fetching and subsequently reduce and distribute calls. Instead of fetching user data individually in `UpdateAccountImageContainer`, `UpdateAccountDetailsFormContainer` and `UpdateAccountNameFormContainer`, data fetching is now performed in the parent component, `AccountSettingsContainer`. Also, implemented partial loading state.
This commit is contained in:
giancarlo
2024-04-16 22:30:41 +08:00
parent 8dd4b594d2
commit d7cf271e8a
5 changed files with 46 additions and 41 deletions

View File

@@ -51,7 +51,13 @@ export function usePersonalAccountData(
enabled: !!userId,
refetchOnWindowFocus: false,
refetchOnMount: false,
initialData: partialAccount,
initialData: partialAccount?.id
? {
id: partialAccount.id,
name: partialAccount.name,
picture_url: partialAccount.picture_url,
}
: undefined,
});
}