diff --git a/src/Components/Common/UpdatableApp.tsx b/src/Components/Common/UpdatableApp.tsx index 8b200d5da0e..172b86d35a9 100644 --- a/src/Components/Common/UpdatableApp.tsx +++ b/src/Components/Common/UpdatableApp.tsx @@ -11,6 +11,7 @@ const APP_UPDATED_KEY = "app-updated"; interface UpdatableAppProps { children: ReactNode; silentlyAutoUpdate?: boolean; + onUpdateLocalStorage?: (() => void) | undefined; } export const checkForUpdate = async () => { @@ -46,7 +47,11 @@ export const checkForUpdate = async () => { } }; -const UpdatableApp = ({ children, silentlyAutoUpdate }: UpdatableAppProps) => { +const UpdatableApp = ({ + children, + silentlyAutoUpdate, + onUpdateLocalStorage, +}: UpdatableAppProps) => { const [newVersion, setNewVersion] = useState(); const [appUpdated, setAppUpdated] = useState(false); @@ -77,7 +82,7 @@ const UpdatableApp = ({ children, silentlyAutoUpdate }: UpdatableAppProps) => { // A second of delay to appreciate the update animation. const updateLocalStorageAndReload = () => { localStorage.setItem(APP_UPDATED_KEY, "true"); - window.location.reload(); + onUpdateLocalStorage && onUpdateLocalStorage(); localStorage.setItem(APP_VERSION_KEY, newVersion); }; diff --git a/src/Components/Users/UserProfile.tsx b/src/Components/Users/UserProfile.tsx index 2dc75d33613..9333007972c 100644 --- a/src/Components/Users/UserProfile.tsx +++ b/src/Components/Users/UserProfile.tsx @@ -164,12 +164,18 @@ export default function UserProfile() { }, }); - const { data: skillsView, loading: isSkillsLoading } = useQuery( - routes.userListSkill, - { - pathParams: { username: authUser.username }, - } - ); + const { + data: skillsView, + refetch: skillsFetch, + loading: isSkillsLoading, + } = useQuery(routes.userListSkill, { + pathParams: { username: authUser.username }, + }); + + const onUpdateLocalStorage = () => { + skillsFetch(); + refetchUserData(); + }; const validateForm = () => { const errors = { ...initError }; @@ -776,7 +782,10 @@ export default function UserProfile() { {updateStatus.isUpdateAvailable && ( - +