diff options
| author | Brendan Allan <[email protected]> | 2026-03-18 17:01:38 +0800 |
|---|---|---|
| committer | Brendan Allan <[email protected]> | 2026-03-18 17:01:38 +0800 |
| commit | 4ba7d3b4062b090ea41c2674a3141c2a66def561 (patch) | |
| tree | 49afc70d372e5e15e45dd715b449a9dc16ebae43 /packages/app/src/utils | |
| parent | a43783a6d47a069ca2fd187c378b8e9899093b37 (diff) | |
| download | opencode-4ba7d3b4062b090ea41c2674a3141c2a66def561.tar.gz opencode-4ba7d3b4062b090ea41c2674a3141c2a66def561.zip | |
app: replace autoselect effects with single resource
Diffstat (limited to 'packages/app/src/utils')
| -rw-r--r-- | packages/app/src/utils/persist.ts | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/packages/app/src/utils/persist.ts b/packages/app/src/utils/persist.ts index bee2f3e7d..3dcbeb7d3 100644 --- a/packages/app/src/utils/persist.ts +++ b/packages/app/src/utils/persist.ts @@ -5,7 +5,12 @@ import { createResource, type Accessor } from "solid-js" import type { SetStoreFunction, Store } from "solid-js/store" type InitType = Promise<string> | string | null -type PersistedWithReady<T> = [Store<T>, SetStoreFunction<T>, InitType, Accessor<boolean>] +type PersistedWithReady<T> = [ + Store<T>, + SetStoreFunction<T>, + InitType, + Accessor<boolean> & { promise: undefined | Promise<any> }, +] type PersistTarget = { storage?: string @@ -460,5 +465,12 @@ export function persisted<T>( { initialValue: !isAsync }, ) - return [state, setState, init, () => ready() === true] + return [ + state, + setState, + init, + Object.assign(() => ready() === true, { + promise: init instanceof Promise ? init : undefined, + }), + ] } |
