mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-02-22 23:57:57 +01:00
12 lines
253 B
TypeScript
12 lines
253 B
TypeScript
import deepEqual from '@gilbarbara/deep-equal';
|
|
import type { Atom } from 'jotai';
|
|
import { selectAtom } from 'jotai/utils';
|
|
|
|
export function deepEqualAtom<T>(a: Atom<T>) {
|
|
return selectAtom(
|
|
a,
|
|
(v) => v,
|
|
(a, b) => deepEqual(a, b),
|
|
);
|
|
}
|