Skip to content

Add fetcher data layer - #10961

Merged
brophdawg11 merged 3 commits into
devfrom
brophdawg11/2-fetcher-data
Oct 26, 2023
Merged

brophdawg11 merged 3 commits into
devfrom
brophdawg11/2-fetcher-data

Conversation

@brophdawg11

@brophdawg11 brophdawg11 commented Oct 25, 2023 •

Copy link
Copy Markdown
Contributor

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

changeset-bot Bot commented Oct 25, 2023 •

Copy link
Copy Markdown

🦋 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 thread packages/react-router-dom/index.tsx Outdated
Comment on lines 353 to 357

Copy link
Copy Markdown
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

Comment thread packages/react-router-dom/index.tsx Outdated

Copy link
Copy Markdown
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

Comment thread packages/react-router-dom/index.tsx Outdated

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

1 participant