Skip to content

Commit

Permalink
fix async store references
Browse files Browse the repository at this point in the history
  • Loading branch information
ryansolid committed Aug 13, 2024
1 parent f8aaf16 commit 19a21cc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/brave-kangaroos-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solidjs/router": patch
---

fix async store references
4 changes: 2 additions & 2 deletions src/data/createAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ export function createAsyncStore<T>(

function createDeepSignal<T>(value: T | undefined, options?: ReconcileOptions) {
const [store, setStore] = createStore({
value
value: structuredClone(value)
});
return [
() => store.value,
(v: T) => {
typeof v === "function" && (v = v());
setStore("value", reconcile(v, options));
setStore("value", reconcile(structuredClone(v), options));
return store.value;
}
] as [Accessor<T | null>, Setter<T | null>];
Expand Down

0 comments on commit 19a21cc

Please sign in to comment.