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
Deprecate useService() #2286
Deprecate useService() #2286
Conversation
🦋 Changeset detectedLatest commit: a0deb5e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
@@ -126,7 +132,7 @@ A [React hook](https://reactjs.org/hooks) that subscribes to state changes from | |||
- `state` - Represents the current state of the service as an XState `State` object. | |||
- `send` - A function that sends events to the running service. | |||
|
|||
### `useActor(actor, getSnapshot)` | |||
### `useActor(actor, getSnapshot?)` |
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.
q: should we support getSnapshot
in the future? or should we just expect that actor.getSnapshot
is available?
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.
We should not (but this is a major breaking change). We should expect .getSnapshot
to be available.
@@ -137,7 +137,7 @@ describe('useService hook', () => { | |||
expect(countEl.textContent).toBe('1'); | |||
}); | |||
|
|||
it('should throw if provided an actor instead of a service', (done) => { | |||
it.skip('should throw if provided an actor instead of a service', (done) => { |
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.
this can be unskipped now, right?
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.
Unskipped
With
.getSnapshot()
, theuseService()
hooks are virtually the same asuseActor()
.