Skip to content

Commit

Permalink
fix: getWorkspaceMembers twice after logging in
Browse files Browse the repository at this point in the history
  • Loading branch information
tienifr committed Mar 25, 2024
1 parent 650026d commit bbbb8e6
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/pages/workspace/WorkspaceMembersPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {useFocusEffect, useIsFocused} from '@react-navigation/native';
import {useIsFocused} from '@react-navigation/native';
import type {StackScreenProps} from '@react-navigation/stack';
import lodashIsEqual from 'lodash/isEqual';
import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react';
Expand Down Expand Up @@ -144,11 +144,13 @@ function WorkspaceMembersPage({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedEmployees, policy?.owner, session?.accountID]);

useFocusEffect(
useCallback(() => {
getWorkspaceMembers();
}, [getWorkspaceMembers]),
);
useEffect(() => {
if (!isFocused) {
return;
}
getWorkspaceMembers();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isFocused]);

useEffect(() => {
validateSelection();
Expand Down

0 comments on commit bbbb8e6

Please sign in to comment.