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

Flush effects after initial render #34

Merged
merged 1 commit into from
Apr 14, 2019
Merged

Conversation

robertknight
Copy link
Member

Flush any effects scheduled with useEffect using the act helper
on the initial render.

This means that in a test a developer can write:

const wrapper = mount(<ComponentThatUsesEffects/>)

And know that effects will have been run before they start interacting
with the result wrapper.

See enzymejs/enzyme#2034 for corresponding change
to the React adapter.

Flush any effects scheduled with `useEffect` using the `act` helper
on the initial render.

This means that in a test a developer can write:

```
const wrapper = mount(<ComponentThatUsesEffects/>)
```

And know that effects will have been run before they start interacting
with the result wrapper.

See enzymejs/enzyme#2034 for corresponding change
to the React adapter.
@robertknight robertknight merged commit 5eaa31e into master Apr 14, 2019
@robertknight robertknight deleted the flush-effects-on-render branch April 14, 2019 21:59
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.

1 participant