Skip to content

Commit

Permalink
Fix firefox recoil snapshot bug (#2321)
Browse files Browse the repository at this point in the history
fix firefox recoil snapshot bug
  • Loading branch information
bosiraphael authored Nov 2, 2023
1 parent 9725582 commit f19ed5e
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions front/src/modules/debug/components/RecoilDebugObserver.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useEffect } from 'react';
import { useRecoilSnapshot, useRecoilValue } from 'recoil';
import { useRecoilTransactionObserver_UNSTABLE, useRecoilValue } from 'recoil';

import { isDebugModeState } from '@/client-config/states/isDebugModeState';
import { logDebug } from '~/utils/logDebug';
Expand All @@ -16,15 +15,12 @@ const formatTitle = (stateName: string) => {
};

export const RecoilDebugObserverEffect = () => {
const snapshot = useRecoilSnapshot();

const isDebugMode = useRecoilValue(isDebugModeState);

useEffect(() => {
useRecoilTransactionObserver_UNSTABLE(({ snapshot }) => {
if (!isDebugMode) {
return;
}

for (const node of Array.from(
snapshot.getNodes_UNSTABLE({ isModified: true }),
)) {
Expand All @@ -40,7 +36,6 @@ export const RecoilDebugObserverEffect = () => {

console.groupEnd();
}
}, [isDebugMode, snapshot]);

});
return null;
};

0 comments on commit f19ed5e

Please sign in to comment.