-
-
Notifications
You must be signed in to change notification settings - Fork 634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
alternate implementation for #2801 #2888
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
commit: |
Size Change: +553 B (+0.6%) Total Size: 92.6 kB
ℹ️ View Unchanged
|
Preview in LiveCodesLatest commit: 7fb805c
See documentations for usage instructions. |
@@ -1,3 +1,5 @@ | |||
import type { INTERNAL_PrdStore as Store } from './store' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import type { INTERNAL_PrdStore as Store } from './store' | |
import type { PrdOrDevStore as Store } from './store' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's correct for the current implementation, but as I plan to remove DevStore by default in the future, this limits more. Maybe I did wrong with S extends Store
too.
src/vanilla/store.ts
Outdated
@@ -260,6 +264,7 @@ type StoreArgs = readonly [ | |||
atom: WritableAtom<Value, Args, Result>, | |||
setAtom: (...args: Args) => Result, | |||
) => OnUnmount | void, | |||
atomOnInit: <Value>(atom: Atom<Value>, store: Store) => void, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should Init come before Mount in StoreArgs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with it.
src/vanilla/store.ts
Outdated
setAtomState: <Value>( | ||
atom: Atom<Value>, | ||
atomState: AtomState<Value>, | ||
) => AtomState<Value>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 😎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though, returning a (possibly modified) atomState is not very intuitive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, maybe this could help, though its a little pedantic
setAtomState: <Value, AS extends AtomState<Value>>(
atom: Atom<Value>,
atomState: AS,
) => AS,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. The arg must be original one.
alternate implementation for #2801
Goals:
Remaining:
FIXME
comments in effect.test.ts