Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix firefox recoil snapshot bug #2321

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
};
Loading