Skip to content

Conversation

@brophdawg11
Copy link
Contributor

@brophdawg11 brophdawg11 commented Oct 25, 2023

Dependent on #10960

Adds a fetcher data layer to RouterProvider to setup the 3rd (and final) PR for this work (a future flag to change the fetcher cleanup/persistence behavior)

@changeset-bot
Copy link

changeset-bot bot commented Oct 25, 2023

🦋 Changeset detected

Latest commit: a9c1886

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-dom Patch
react-router 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

Comment on lines +353 to +357
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fetcher data lives in the React layer now, and we use ref counting via register/unregister to know when to remove from fetcherData

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fetcher data hand-off from the router to the React data layer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we're OK using a ref here but I need to bang on some edge cases to be sure - all tests and such pass as-is which is reassuring. The idea is that anytime a fetcher.data needs to update - a fetcher will have changed state which will be what triggers the re-render, and we don't need useState version of fetcherData.

@brophdawg11 brophdawg11 force-pushed the brophdawg11/2-fetcher-data branch from d3adf5e to a9c1886 Compare October 26, 2023 19:10
@brophdawg11 brophdawg11 merged commit cb2d911 into dev Oct 26, 2023
@brophdawg11 brophdawg11 deleted the brophdawg11/2-fetcher-data branch October 26, 2023 19:17
@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version 6.18.0-pre.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version 6.18.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

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.

2 participants