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

[Bug]: Fetchers have no data in remix test with yarn pnp #12163

Open
alisd23 opened this issue Oct 21, 2024 · 0 comments
Open

[Bug]: Fetchers have no data in remix test with yarn pnp #12163

alisd23 opened this issue Oct 21, 2024 · 0 comments
Labels

Comments

@alisd23
Copy link
Contributor

alisd23 commented Oct 21, 2024

What version of React Router are you using?

6.27.0

Steps to Reproduce

See reproduction + Readme here: https://codesandbox.io/p/devbox/5xv9jn?file=%2FREADME.md%3A25%2C37

I have set up a very simple test case to show the fetcher data being wrong. This seems like a test-only issue as I discovered it while using createRemixStub, and I haven't seen a similar issue before in my actual app.

I wasn't sure whether to file this in the react-router or remix repository, but I think the core issue is here in react-router, even though the reproduction uses Remix.

Follow instructions to simply flip between pnp (failing) and non-pnp (passing) mode.

Expected Behavior

The fetcher returned from useFetcher should include a data value of { result: 100 }, as returned from the action.

Actual Behavior

The data property from useFetcher() stays undefined, even after the action successfully returns.

Interestingly the fetcher details returned from useFetchers() (plural) does show the resolved action data - which is very strange.

Took a bit of a look but the RR code is fairly complex. There is a suspicious looking fetcherData ref, which is passed down to in a context provider value as fetcherData.current, which could maybe be a source of pain (as changing a ref value won't automatically trigger re-render). But that's just a hunch.

@alisd23 alisd23 added the bug label Oct 21, 2024
@alisd23 alisd23 changed the title [Bug]: Fetchers have no data in tests with yarn pnp [Bug]: Fetchers have no data in remix test with yarn pnp Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant