Skip to content

Commit

Permalink
supports: atom toString includes debugLabel in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dmaskasky committed Jul 15, 2024
1 parent 2271706 commit 76ceb5f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/useAtomsDevtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import { SnapshotOptions, useAtomsSnapshot } from './useAtomsSnapshot';
import { useGotoAtomsSnapshot } from './useGotoAtomsSnapshot';

const atomToPrintable = (atom: AnyAtom) =>
atom.debugLabel ? `${atom}:${atom.debugLabel}` : `${atom}`;
atom.debugLabel && !String(atom).includes(':')
? `${atom}:${atom.debugLabel}`
: `${atom}`;

const getDevtoolsState = (atomsSnapshot: AtomsSnapshot) => {
const values: Record<string, AnyAtomValue> = {};
Expand Down

0 comments on commit 76ceb5f

Please sign in to comment.