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 14, 2024
1 parent 2271706 commit 3b1cd8e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/utils/useAtomsDevtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ import { getReduxExtension } from './redux-extension/getReduxExtension';
import { SnapshotOptions, useAtomsSnapshot } from './useAtomsSnapshot';
import { useGotoAtomsSnapshot } from './useGotoAtomsSnapshot';

const atomToPrintable = (atom: AnyAtom) =>
atom.debugLabel ? `${atom}:${atom.debugLabel}` : `${atom}`;
const atomToPrintable = (atom: AnyAtom) => {
let str = `${atom}`;
if (atom.debugLabel && !str.endsWith(":" + atom.debugLabel)) {

Check failure on line 13 in src/utils/useAtomsDevtools.ts

View workflow job for this annotation

GitHub Actions / build

Replace `":"` with `':'`
str += ":" + atom.debugLabel;

Check failure on line 14 in src/utils/useAtomsDevtools.ts

View workflow job for this annotation

GitHub Actions / build

Replace `":"` with `':'`
}
return str;
};

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

0 comments on commit 3b1cd8e

Please sign in to comment.