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

Deprecate useService() #2286

Merged
merged 13 commits into from Jun 18, 2021
Merged

Deprecate useService() #2286

merged 13 commits into from Jun 18, 2021

Conversation

davidkpiano
Copy link
Member

With .getSnapshot(), the useService() hooks are virtually the same as useActor().

@changeset-bot
Copy link

changeset-bot bot commented Jun 7, 2021

🦋 Changeset detected

Latest commit: a0deb5e

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 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

@davidkpiano davidkpiano marked this pull request as ready for review June 14, 2021 17:20
@@ -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?)`
Copy link
Member

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?

Copy link
Member Author

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) => {
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unskipped

@davidkpiano davidkpiano merged commit 507f244 into main Jun 18, 2021
This was referenced Jun 18, 2021
@Andarist Andarist deleted the davidkpiano/deprecate-useservice branch March 22, 2023 15:06
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.

None yet

2 participants