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

React 18 migration for waitForNextUpdate repeats steps for waitForValueToChange instead #975

Open
sfc-gh-mgolebiowskiowczarek opened this issue Oct 10, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@sfc-gh-mgolebiowskiowczarek
  • react-hooks-testing-library version: N/A
  • react version: N/A
  • react-dom version (if applicable): N/A
  • react-test-renderer version (if applicable): N/A
  • node version: N/A
  • npm (or yarn) version: N/A

Relevant code or config:

N/A

What you did:

I read https://github.com/testing-library/react-hooks-testing-library/blob/chore/migration-guide/MIGRATION_GUIDE.md#waitfornextupdate (section waitForNextUpdate).

What happened:

That section shows the following code snippet:

-await waitForValueToChange(() => result.current.state);
+const initialValue = result.current;
+await waitFor(() => {
+  expect(result.current).not.toBe(initialValue);
+});

Reproduction:

N/A, this is a docs change.

Problem description:

As you can see, it actually shows the migration path for waitForValueToChange which was already handled in the previous section. The code seems erroneously repeated.

Suggested solution:

Provide a proper code migration path, where the "before" state actually uses the waitForNextUpdate API.

@sfc-gh-mgolebiowskiowczarek sfc-gh-mgolebiowskiowczarek added the bug Something isn't working label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant