@@ -66,7 +66,7 @@ declare global {
6666 * @since 1.0.0
6767 * @category Models
6868 */
69- export type Options < const Id extends string , S extends LiveStoreSchema , Context = { } > =
69+ export type Options < S extends LiveStoreSchema , Context = { } > =
7070 & CreateStoreOptions < S , Context >
7171 & {
7272 readonly otelOptions ?: Partial < OtelOptions > | undefined
@@ -79,11 +79,11 @@ export type Options<const Id extends string, S extends LiveStoreSchema, Context
7979export const Tag = < Self > ( ) =>
8080< const Id extends string , S extends LiveStoreSchema , Context = { } > (
8181 id : Id ,
82- options : Options < Id , S , Context > | Atom . Atom < Options < Id , S , Context > >
82+ options : Options < S , Context > | ( ( get : Atom . Context ) => Options < S , Context > )
8383) : AtomLiveStore < Self , Id , S , Context > => {
8484 const self : Mutable < AtomLiveStore < Self , Id , S , Context > > = Context . Tag ( id ) < Self , Store < S , Context > > ( ) as any
8585
86- const layerFromOptions = ( opts : Options < Id , S , Context > ) =>
86+ const layerFromOptions = ( opts : Options < S , Context > ) =>
8787 Layer . scoped (
8888 self ,
8989 createStore ( opts ) . pipe (
@@ -96,7 +96,7 @@ export const Tag = <Self>() =>
9696 )
9797
9898 self . runtime = Atom . runtime (
99- Atom . isAtom ( options ) ? ( get ) => layerFromOptions ( get ( options ) ) : layerFromOptions ( options )
99+ typeof options === "function" ? ( get ) => layerFromOptions ( options ( get ) ) : layerFromOptions ( options )
100100 )
101101 self . layer = self . runtime . layer
102102 self . store = self . runtime . atom ( Effect . contextWith ( Context . get ( self ) ) as any )
0 commit comments