Skip to content

Commit

Permalink
Fix: Remove isCalledVBBARef
Browse files Browse the repository at this point in the history
  • Loading branch information
truph01 committed Jun 8, 2024
1 parent 14bfe67 commit 6b8c4b2
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/pages/workspace/WorkspacePageWithSections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,17 @@ function WorkspacePageWithSections({
const firstRender = useRef(true);
const isFocused = useIsFocused();
const prevPolicy = usePrevious(policy);
const isCalledVBBARef = useRef(false);

useEffect(() => {
// Because isLoading is false before merging in Onyx, we need firstRender ref to display loading page as well before isLoading is change to true
firstRender.current = false;
}, []);

useEffect(() => {
if (isCalledVBBARef.current || !policyID) {
return;
}
isCalledVBBARef.current = true;
fetchData(policyID, shouldSkipVBBACall);
}, [policyID, shouldSkipVBBACall]);
useFocusEffect(
useCallback(() => {
fetchData(policyID, shouldSkipVBBACall);
}, [policyID, shouldSkipVBBACall]),
);

const shouldShow = useMemo(() => {
// If the policy object doesn't exist or contains only error data, we shouldn't display it.
Expand Down

0 comments on commit 6b8c4b2

Please sign in to comment.