fix nested acts - #1468
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit b115de7:
|
There was a problem hiding this comment.
Can you write a test showing the underlying issue instead of testing implementation details (nesting depth)?
There was a problem hiding this comment.
sorry about that, I was stumped on it for a little bit
I got there today though, just needed to sleep on it. done.
|
There is now a React-only public-API reproduction of the underlying failure this PR is working around: react/react#37374 The minimized case removes Testing Library, user-event, Radix, and focus/blur behavior entirely. A re-entrant That issue includes a standalone |
What:
Closes #1231
And removes the need for testing-library/user-event#1283
Why:
testing-library/user-event#1283
How:
By tracking if we're already inside an
act, we can avoid wrapping it in a new one. At the same time, we can keep the wrapper around all events, which is an expectation using testing library'sconfigureChecklist:
docs site
Originally I was going to make this change over in user event, we have two PRs to do it, however, it's really a React and Preact concern. Changing it in User Event would affect everyone. Angular testing library already wraps all events for a different reason and so removing an event from that callback wrapper could be unexpected or breaking. I would guess this change is also needed in the Preact testing library repo as well.