Skip to content

Commit

Permalink
refactor: add date clear on unmount
Browse files Browse the repository at this point in the history
  • Loading branch information
kate-deriv committed Aug 5, 2024
1 parent 6000927 commit 25c4fbb
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const PositionsContent = observer(({ hasButtonsDemo, isClosedTab, setHasButtonsD
onMount: onClosedTabMount,
onUnmount: onClosedTabUnmount,
} = useReportsStore().profit_table;
// console.log('data', data);
const closedPositions = React.useMemo(() => data.map(d => ({ contract_info: d })), [data]);
const positions = React.useMemo(
() => (isClosedTab ? closedPositions : active_positions),
Expand Down Expand Up @@ -112,7 +113,10 @@ const PositionsContent = observer(({ hasButtonsDemo, isClosedTab, setHasButtonsD
isClosedTab ? onClosedTabMount(true) : onOpenTabMount();

return () => {
isClosedTab && onClosedTabUnmount();
if (isClosedTab) {
clearTable();
onClosedTabUnmount();
}
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Expand Down

0 comments on commit 25c4fbb

Please sign in to comment.