Skip to content

Commit

Permalink
update statebuilder, fix asyncState synchronization
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardoperra committed Nov 5, 2024
1 parent ffc54d3 commit 4436bba
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"solid-js": "^1.9.3",
"solid-jsx": "^1.1.4",
"solid-mdx": "^0.0.7",
"statebuilder": "^0.7.2",
"statebuilder": "^0.7.3",
"unique-names-generator": "^4.7.1",
"vinxi": "^0.4.3",
"vscode-languageserver-protocol": "^3.17.5",
Expand Down
5 changes: 3 additions & 2 deletions packages/app/src/lib/statebuilder/async.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {AccessorWithLatest, createAsync} from '@solidjs/router';
import {createEffect, createSignal, on, Setter} from 'solid-js';
import {createComputed, createSignal, on, Setter} from 'solid-js';
import {create} from 'statebuilder';

export interface AsyncSignalState<T> {
Expand Down Expand Up @@ -32,7 +32,7 @@ function makeAsyncSignal<T>(
options?.initialValue,
);

createEffect(
createComputed(
on(asyncState, latest => {
// Sync latest signal retrieved by asyncState in order to be available globally after navigation
setSignal(() => latest);
Expand All @@ -51,5 +51,6 @@ function makeAsyncSignal<T>(
* Define an async signal.
*
* @experimental TODO port to statebuilder?
*
*/
export const eDefineAsync = create('asyncSignal', makeAsyncSignal);
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4436bba

Please sign in to comment.