Skip to content

Commit

Permalink
AL: fix linking bug
Browse files Browse the repository at this point in the history
  • Loading branch information
adalundhe committed Feb 25, 2024
1 parent ee0cfe8 commit 40b5fd3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "delta-state",
"version": "1.1.2",
"version": "1.1.3",
"description": "A modern version of the Delta state manager - written for TS and with the use of React Hooks.",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
8 changes: 4 additions & 4 deletions src/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ const createImpl = <T extends StoreApi<T>>(store: Store<T>, init: T) => {
export const useAtom = <T>(
atom: T,
update: (set: (next: T) => T) => (next: T) => T | Promise<T>,
link?: (atom: T) => boolean
link?: (atom: T) => T
) => {

const atomStore = link && link(atom) ? useMemo(
const atomStore = link ? useMemo(

Check failure on line 48 in src/react.ts

View workflow job for this annotation

GitHub Actions / build

React Hook "useMemo" is called conditionally. React Hooks must be called in the exact same order in every component render
() =>

Check failure on line 49 in src/react.ts

View workflow job for this annotation

GitHub Actions / build

React Hook "useRef" is called conditionally. React Hooks must be called in the exact same order in every component render
new Atom<T>(atom),
[atom],
new Atom<T>(link(atom)),
[atom, link],
) : useRef(new Atom<T>(atom)).current;

const set = (next :T) => {
Expand Down

0 comments on commit 40b5fd3

Please sign in to comment.