Compare commits

...

3 Commits

Author SHA1 Message Date
pax-k
849c2b9ffc fix(useCoState): requested changes 2025-03-10 16:30:07 +02:00
pax-k
56860d406b chore: changeset 2025-02-28 13:12:48 +02:00
pax-k
357d1b4c8d fix: useCoState stale data 2025-02-28 13:11:47 +02:00
2 changed files with 13 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
"jazz-react-core": patch
---
Fix useCoState stale data

View File

@@ -135,7 +135,14 @@ export function useCoState<V extends CoValue, D>(
() => observable.getCurrentValue(),
);
return value;
return React.useMemo(() => {
if (!id) {
observable.reset();
return undefined;
}
return value;
}, [id, value]);
}
export function createUseAccountHooks<Acc extends Account>() {