-
Notifications
You must be signed in to change notification settings - Fork 5
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
req: derivate children snapshot #11
Comments
@brunocangs thoughts? |
I've never coded anything that spawns children before so not sure. Could you provide a basic example and point where it breaks? Maybe we can come up with an idea Edit: typo |
Ye ofc, I'll send you and example today when I'll get back home, thank you! |
@brunocangs Here a link I also added some comments inside the code, let me know if it makes sense for you! Thank you https://stackblitz.com/edit/vitejs-vite-rd4cpznr?file=src%2FApp.tsx |
Thanks! I'll take a look and play around and get back to you in a few hours |
@DavideSegullo It seems that a quick fix allowing the atom to handle undefined is enough to cover the case you showed on the stackblitz. Could you check the PR/branch to see if it fixes the problem? I tested it with the example you provided and it seemed to work well. Do you have any other cases this change might not cover? Edit: added second image |
It looks good, I tried it locally by patching |
So actually we can suppress this error by casting |
Hi guys, I'm trying to use jotai-xstate to derivate children actor snapshot, the context is that I have a parent state machine, which based on conditions spaws children, I would like to be able to access the snapshot of these children (when spawned) to be able to determine the substates of the children, is this already possible using
atomWithActorSnapshot
?I assume not because if the actor used as input changes, a new subscription is not created. Maybe we only need a way to detect input atom changes and then subscribe again
If someone can give me some suggestions I can also try to do a PR myself, thank you!
For example using react is possible to use
useSelector
with empty actor if it's undefined: https://stately.ai/docs/actors#empty-actorsThe text was updated successfully, but these errors were encountered: