Skip to content

Commit

Permalink
fix(utils): dev-only deprecation message (#2491)
Browse files Browse the repository at this point in the history
  • Loading branch information
dai-shi authored Apr 8, 2024
1 parent a3be09e commit 2d2f03a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/vanilla/utils/freezeAtom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ export function freezeAtom(
export function freezeAtomCreator<
CreateAtom extends (...args: unknown[]) => Atom<unknown>,
>(createAtom: CreateAtom): CreateAtom {
console.warn(
'[DEPRECATED] freezeAtomCreator is deprecated, define it on users end',
)
if (import.meta.env?.MODE !== 'production') {
console.warn(
'[DEPRECATED] freezeAtomCreator is deprecated, define it on users end',
)
}
return ((...args: unknown[]) => freezeAtom(createAtom(...args))) as never
}

0 comments on commit 2d2f03a

Please sign in to comment.