Skip to content

Commit

Permalink
fix: SSR
Browse files Browse the repository at this point in the history
  • Loading branch information
petyosi committed Mar 29, 2024
1 parent a0659d1 commit 3821767
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ export function useCellValue<T>(cell: NodeRef<T>) {
[realm, cell]
)

return React.useSyncExternalStore(cb, () => realm.getValue(cell))
return React.useSyncExternalStore(
cb,
() => realm.getValue(cell),
() => realm.getValue(cell)
)
}

/**
Expand Down Expand Up @@ -99,7 +103,11 @@ export function useCellValues(...cells: Array<NodeRef<unknown>>): unknown[] {
// eslint-disable-next-line react-hooks/exhaustive-deps
[realm, ...cells]
)
return React.useSyncExternalStore(cb, () => currentRef.current)
return React.useSyncExternalStore(
cb,
() => currentRef.current,
() => currentRef.current
)
}

/**
Expand Down

0 comments on commit 3821767

Please sign in to comment.