Skip to content
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

Add initial support for xstate/store/solid #5056

Merged
merged 6 commits into from
Aug 28, 2024

Conversation

steveadams
Copy link
Contributor

I've added useSelector support to xstate/store for SolidJS which seems to be working well in my tests. Let me know what I can improve and I'd be happy to do it.

Copy link

changeset-bot bot commented Aug 27, 2024

🦋 Changeset detected

Latest commit: 4136506

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@xstate/store Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@steveadams
Copy link
Contributor Author

Apologies for the force pushes; I can move this to a clean branch with a single commit instead if they're a problem.

* previously selected value
* @returns A read-only signal of the selected value
*/
export function useSelector<TStore extends Store<any, any>, T>(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I initially went with the name createSelector, and I might actually prefer it. I'm not sure what the consensus is on naming functions like this in SolidJS. The library itself has use* as well as create* naming conventions for functions like this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine, whatever is most idiomatic!

Copy link
Contributor Author

@steveadams steveadams Aug 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just noticing the other solid-related code uses useActor and useMachine for example so I think this makes sense.

Copy link
Member

@davidkpiano davidkpiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much for this!

@steveadams
Copy link
Contributor Author

You're welcome! I really enjoyed this process and I'm stoked to contribute to XState.

@davidkpiano davidkpiano merged commit 8c35da9 into statelyai:main Aug 28, 2024
1 check passed
@github-actions github-actions bot mentioned this pull request Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants