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

Stabilize useRevalidator #10707

Merged
merged 4 commits into from
Jul 19, 2023
Merged

Conversation

brophdawg11
Copy link
Contributor

@brophdawg11 brophdawg11 commented Jul 14, 2023

Closes #10706

I also restructured some unit tests in 28d8eed. Began with pulling out useRevalidator tests from the larger data-memory-router-test and then that led to moving some utils to standalone files and leveraging them instead of copy/pasting them across test suites.

@changeset-bot
Copy link

changeset-bot bot commented Jul 14, 2023

🦋 Changeset detected

Latest commit: b9eed2d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
react-router Patch
react-router-dom Patch
react-router-dom-v5-compat Patch
react-router-native Patch

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

@brophdawg11 brophdawg11 linked an issue Jul 17, 2023 that may be closed by this pull request
@@ -909,107 +909,6 @@ describe("createMemoryRouter", () => {
});
});

it("reloads data using useRevalidator", async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Existing tests extracted to `use-revalidator-test.tsx

expect(router.state.errors).toBe(null);
});

it("is stable across location changes", async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Net new functionality test

Comment on lines +824 to +830
return React.useMemo(
() => ({
revalidate: dataRouterContext.router.revalidate,
state: state.revalidation,
}),
[dataRouterContext.router.revalidate, state.revalidation]
);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the only functional change in this PR

@brophdawg11 brophdawg11 merged commit 78ef4ef into dev Jul 19, 2023
@brophdawg11 brophdawg11 deleted the brophdawg11/stabilize-use-revalidator branch July 19, 2023 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should useRevalidator be stable?
1 participant