mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-17 06:19:41 +02:00
Prevent a bunch more stuff from re-rendering
This commit is contained in:
11
src-web/lib/atoms.ts
Normal file
11
src-web/lib/atoms.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
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),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user