fix(frontend): onBoarding issue (#2374)

# Description

Please include a summary of the changes and the related issue. Please
also include relevant motivation and context.

## Checklist before requesting a review

Please delete options that are not relevant.

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented hard-to-understand areas
- [ ] I have ideally added tests that prove my fix is effective or that
my feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged

## Screenshots (if appropriate):
This commit is contained in:
Antoine Dewez 2024-03-21 12:35:49 -07:00 committed by GitHub
parent 4aeb00fd47
commit b342691ecf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View File

@ -20,8 +20,10 @@ export const OnboardingProvider = ({
const { userIdentityData } = useUserData(); const { userIdentityData } = useUserData();
useEffect(() => { useEffect(() => {
setIsOnboardingModalOpened(!!userIdentityData?.onboarded); if (userIdentityData) {
}, []); setIsOnboardingModalOpened(!userIdentityData.onboarded);
}
}, [userIdentityData]);
return ( return (
<OnboardingContext.Provider <OnboardingContext.Provider

View File

@ -2,9 +2,16 @@ import { useQuery } from "@tanstack/react-query";
import { USER_DATA_KEY, USER_IDENTITY_DATA_KEY } from "../api/user/config"; import { USER_DATA_KEY, USER_IDENTITY_DATA_KEY } from "../api/user/config";
import { useUserApi } from "../api/user/useUserApi"; import { useUserApi } from "../api/user/useUserApi";
import { UserIdentity } from "../api/user/user";
import { UserStats } from "../types/User";
type UseUserDataProps = {
userData: UserStats | undefined;
userIdentityData: UserIdentity | undefined;
};
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
export const useUserData = () => { export const useUserData = (): UseUserDataProps => {
const { getUser } = useUserApi(); const { getUser } = useUserApi();
const { getUserIdentity } = useUserApi(); const { getUserIdentity } = useUserApi();