From caa6a53fb8da10654fe90800ad78ca4de9fc84cc Mon Sep 17 00:00:00 2001 From: Thomas Zemp Date: Mon, 11 Dec 2023 15:55:20 +0100 Subject: [PATCH] fix: retrieve user locales [DHIS2-16170] --- src/pages/EditUser.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pages/EditUser.js b/src/pages/EditUser.js index c0ff9170e..8d1edd2b3 100644 --- a/src/pages/EditUser.js +++ b/src/pages/EditUser.js @@ -44,6 +44,7 @@ const userSettingsQuery = { const useUser = (userId) => { const user = useDataQuery(userQuery, { lazy: true }) + const username = user.data?.user?.userCredentials?.username const userSettings = useDataQuery(userSettingsQuery, { lazy: true }) useEffect(() => { @@ -57,11 +58,10 @@ const useUser = (userId) => { }, [user, userId]) useEffect(() => { - if (user.data?.user && !userSettings.data) { - const { username } = user.data.user.userCredentials + if (username) { userSettings.refetch({ username }) } - }, [user, userSettings]) + }, [username]) const loading = !user.called ||