-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fixed issue with useService
returning an initial state for services in their final states
#1504
Conversation
… in their final states
🦋 Changeset detectedLatest commit: f8e15ae The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
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 |
@@ -17,7 +17,7 @@ export function fromService<TContext, TEvent extends EventObject>( | |||
send: service.send.bind(service), | |||
subscribe: service.subscribe.bind(service), | |||
stop: service.stop!, | |||
current: service.initialized ? service.state : machine.initialState, | |||
current: service._status !== 0 ? service.state : machine.initialState, |
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 probably import InterpreterStatus
here
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.
couldn't do this right now, because the older XState versions don't have such export - I've exported InterpreterStatus
from the xstate
package though and added a comment here that we should migrate to it whenever we decide to release a new major of @xstate/react
fixes #1503