Skip to content

Commit

Permalink
fix: retrieve user locales [DHIS2-16170]
Browse files Browse the repository at this point in the history
  • Loading branch information
tomzemp committed Dec 11, 2023
1 parent e6a0da2 commit caa6a53
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/pages/EditUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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 ||
Expand Down

0 comments on commit caa6a53

Please sign in to comment.