Skip to content

Commit

Permalink
DOMA-376 Clean state on logout
Browse files Browse the repository at this point in the history
(cherry picked from commit 3369e55)
  • Loading branch information
SavelevMatthew committed Dec 1, 2021
1 parent 833835b commit 6691926
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/@core.next/organization.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ const OrganizationProvider = ({ children, initialLinkValue }) => {
const [linkIdState, setLinkIdState] = useState(initialLinkValue && initialLinkValue.id || cookieOrganizationEmployee)
const [link, setLink] = useState(initialLinkValue)

useEffect(() => {
if (!(initialLinkValue && initialLinkValue.id || cookieOrganizationEmployee)) {
setLinkIdState(null)
}
}, [initialLinkValue, cookieOrganizationEmployee])

const { loading: linkLoading, refetch } = useQuery(GET_ORGANIZATION_TO_USER_LINK_BY_ID_QUERY, {
variables: { id: linkIdState },
skip: auth.isLoading || !auth.user || !linkIdState,
Expand Down

0 comments on commit 6691926

Please sign in to comment.