Skip to content

[@xstate/store] v3#5175

Merged
davidkpiano merged 26 commits intomainfrom
davidkpiano/store-v3
Feb 9, 2025
Merged

[@xstate/store] v3#5175
davidkpiano merged 26 commits intomainfrom
davidkpiano/store-v3

Conversation

@davidkpiano
Copy link
Member

No description provided.

@changeset-bot
Copy link

changeset-bot bot commented Jan 22, 2025

🦋 Changeset detected

Latest commit: c2ea8e3

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 Major

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

davidkpiano and others added 3 commits January 21, 2025 21:29
- Added `StoreEffect` type to support both emitted events and side effects.
- Updated `createStoreTransition` to return effects instead of emitted events.
- Modified `receive` function to handle effects, executing functions or emitting events accordingly.
- Added a test case to verify that effects can be enqueued and executed after state updates.

This change improves the flexibility of the store's event handling mechanism.
@davidkpiano davidkpiano marked this pull request as ready for review January 25, 2025 13:32
- Updated `createStore` and `createStoreWithProducer` to use more explicit type parameters
- Replaced `types: { emitted }` with separate type parameters for context, event payloads, and emitted events
- Removed `Cast` import and simplified type definitions
- Updated test cases to use new type parameter approach
- Added `EventMap` type to support event type mapping
@expelledboy
Copy link

expelledboy commented Feb 1, 2025

Oh no... 😭 #5183

Figuring out how to pass the types around was difficult. But I think I made some improvements, even beyond the new getter API.

But when I saw how many changes where in this PR... I am going to get a beer.

@davidkpiano
Copy link
Member Author

Oh no... 😭 #5183

Figuring out how to pass the types around was difficult. But I think I made some improvements, even beyond the new getter API.

But when I saw how many changes where in this PR... I am going to get a beer.

Hey @expelledboy – computed properties are a great idea! I think you'll find the types even simpler to work with in this PR. Let's make it work. 🛠️

davidkpiano and others added 2 commits February 8, 2025 21:11
Co-authored-by: Mateusz Burzyński <mateuszburzynski@gmail.com>
@davidkpiano davidkpiano merged commit 38aa9f5 into main Feb 9, 2025
1 check passed
@davidkpiano davidkpiano deleted the davidkpiano/store-v3 branch February 9, 2025 02:55
@github-actions github-actions bot mentioned this pull request Feb 9, 2025
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.

3 participants