File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ export interface AtomFamily<Param, AtomType> {
3939 unstable_listen ( callback : Callback < Param , AtomType > ) : Cleanup
4040}
4141
42+ let didWarnDeprecation = false
43+
4244/**
4345 * @deprecated atomFamily is deprecated and will be removed in v3.
4446 * Please use the `jotai-family` package instead: https://github.com/jotaijs/jotai-family
@@ -63,6 +65,13 @@ export function atomFamily<Param, AtomType extends Atom<unknown>>(
6365 initializeAtom : ( param : Param ) => AtomType ,
6466 areEqual ?: ( a : Param , b : Param ) => boolean ,
6567) {
68+ if ( import . meta. env ?. MODE !== 'production' && ! didWarnDeprecation ) {
69+ console . warn (
70+ '[DEPRECATED] atomFamily is deprecated and will be removed in v3. ' +
71+ 'Please use the `jotai-family` package instead: https://github.com/jotaijs/jotai-family' ,
72+ )
73+ didWarnDeprecation = true
74+ }
6675 let shouldRemove : ShouldRemove < Param > | null = null
6776 const atoms : Map < Param , [ AtomType , CreatedAt ] > = new Map ( )
6877 const listeners = new Set < Callback < Param , AtomType > > ( )
You can’t perform that action at this time.
0 commit comments