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

[@xstate/react] Add support for getShapshot() #2223

Merged
merged 5 commits into from
May 22, 2021

Conversation

davidkpiano
Copy link
Member

@davidkpiano davidkpiano commented May 20, 2021

This PR adds support for actors with the actor.getSnapshot() method in the useActor(...) hook.

@changeset-bot
Copy link

changeset-bot bot commented May 20, 2021

🦋 Changeset detected

Latest commit: b50fc87

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

This PR includes changesets to release 1 package
Name Type
@xstate/react Patch

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

@@ -1275,18 +1275,25 @@ export interface ActorRef<TEvent extends EventObject, TEmitted = any>
send: Sender<TEvent>;
}

export interface SpawnedActorRef<TEvent extends EventObject, TEmitted = any>
extends ActorRef<TEvent, TEmitted> {
export interface SpawnedActorRef<
Copy link
Member

Choose a reason for hiding this comment

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

writing down somewhere what is considered to be an Actor, ActorRef and SpawnedActorRef would be very helpful - I often have to recheck this on my own in the codebase as it's not entirely intuitive for me (especially the distinction between ActorRef and SpawnedActorRef

Copy link
Contributor

Choose a reason for hiding this comment

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

Could write that down right here to start 😁 Pretty please!

Copy link
Member Author

Choose a reason for hiding this comment

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

packages/core/src/types.ts Outdated Show resolved Hide resolved
packages/core/src/types.ts Show resolved Hide resolved
@davidkpiano davidkpiano added this to Committed in Next May 22, 2021
@davidkpiano davidkpiano changed the title [@xstate/react] Add support for actor.getSnapshot() https://github.com/davidkpiano/xstate/pull/2223#discussion_r637368750 May 22, 2021
@davidkpiano davidkpiano changed the title https://github.com/davidkpiano/xstate/pull/2223#discussion_r637368750 Consider how TEmitted and getSnapshot() return values relate May 22, 2021
@davidkpiano davidkpiano merged commit a130b17 into main May 22, 2021
Next automation moved this from Committed to Done May 22, 2021
@davidkpiano davidkpiano changed the title Consider how TEmitted and getSnapshot() return values relate [@xstate/react] Add support for getShapshot() May 22, 2021
This was referenced May 22, 2021
@Andarist Andarist deleted the davidkpiano/getsnapshot-react branch March 22, 2023 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Next
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants