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

[solid-query] Uncaught (in promise) Error: experimental_prefetchInRender feature flag is not enabled #8209

Open
BierDav opened this issue Oct 23, 2024 · 11 comments

Comments

@BierDav
Copy link
Contributor

BierDav commented Oct 23, 2024

Describe the bug

When using the latest version of tanstack-query you get at least in solidjs for each query this error message in the console:

Uncaught (in promise) Error: experimental_prefetchInRender feature flag is not enabled

Your minimal, reproducible example

https://codesandbox.io/p/github/BierDav/temp-tanstack-query-ssr-bug/experimental-flag-warning

Steps to reproduce

  1. Just start it using bun i && bun dev

Expected behavior

No error message in the console, because the promise wasn't even accessed

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

  • OS: Windows, Linux

Tanstack Query adapter

solid-query

TanStack Query version

v5.59.13

TypeScript version

No response

Additional context

I have looked into the code. It is not really that something went wrong, and more about that the promise which causes this issue is evaluated even though the feature is not set.

Probably the easiest solution is to replace the promise when the flag is not enable with a getter function which then only throws the error, when the promise is really accessed.

@TkDodo
Copy link
Collaborator

TkDodo commented Oct 23, 2024

Note: i can’t access your sandbox - it’s likely set to private.

I see no error in the Solid Query Simple example:

https://stackblitz.com/github/tanstack/query/tree/main/examples/solid/simple?embed=1&theme=dark&preset=node&file=src/index.tsx

@indeyets
Copy link

we see this issue too in our setup. (solid-start, without bun)

@TkDodo the url in example is pasted 2 times. just copy one of the halves. opens fine here

@PeterDraex
Copy link

PeterDraex commented Oct 24, 2024

StackBlitz link for the same repo:
https://stackblitz.com/~/github.com/BierDav/temp-tanstack-query-ssr-bug
After waiting for the dev server to start, I had to click on "http://localhost:3000/" in the terminal. Then I see JSON in the preview and the error in browser console.

I'm also experiencing the experimental_prefetchInRender feature flag error in my SolidJS project.

@BierDav
Copy link
Contributor Author

BierDav commented Oct 24, 2024

we see this issue too in our setup. (solid-start, without bun)

@TkDodo the url in example is pasted 2 times. just copy one of the halves. opens fine here

sorry for that i fixed it

@0-don
Copy link

0-don commented Oct 31, 2024

having the same issue, this seems to be happening since 5.59.0

@YosefBayoude
Copy link

Can confirm, rolling back to 5.56.2 does not present this.
Even in the docs own example this issue is present https://tanstack.com/query/latest/docs/framework/solid/examples/solid-start-streaming ; to see it happening go to the "mixed" page for example and reload, issue appears in the console

@PeterDraex
Copy link

@YosefBayoude I rolled back to 5.45.0 which doesn't have this issue

@TkDodo TkDodo removed the needs-info label Nov 3, 2024
@TkDodo
Copy link
Collaborator

TkDodo commented Nov 3, 2024

codesandobx still doesn’t work for me, but stackblitz does: https://stackblitz.com/github/BierDav/temp-tanstack-query-ssr-bug/tree/experimental-flag-warning

@KATT this promise rejection shows up in the solid-js adapter:

if (!this.options.experimental_prefetchInRender) {
this.#currentThenable.reject(
new Error('experimental_prefetchInRender feature flag is not enabled'),
)
}

Not sure why it works for react though 🤔

Is there a better place where we can reject the promise - or should we do it at all?

@vlad99902
Copy link

@TkDodo have the same issue in React (

@KATT
Copy link
Contributor

KATT commented Nov 6, 2024

This is odd, we add a .catch(() => to prevent this:

thenable.catch(() => {
// prevent unhandled rejection errors
})

Can this be a Vite-thing or something? 🤔

@TkDodo
Copy link
Collaborator

TkDodo commented Nov 6, 2024

@vlad99902 I haven’t seen this in react so far - can you make a reproduction for that please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants