Skip to content
Source
Sign inSign up
TanStack/devtools

Solid.js 'multiple instances' warnings appear in React apps with Vite 8 #411

Openabed-daloopa(GitHub profile, opens in a new tab) opened this issue 6 comments

TanStack Devtools version

@tanstack/react-devtools v0.10.1, @tanstack/devtools-vite v0.6.0

Framework/Library version

React 19.2.4, TanStack Start 1.167.16, Vite 8.0.3

Describe the bug and the steps to reproduce it

When using TanStack Devtools in a React TanStack Start app with Vite 8, the following warnings appear in the terminal and browser when starting the dev server

❯ bun run dev
$ vite dev --port 3000

  VITE v8.0.3  ready in 1039 ms

  ➜  Local:   http://localhost:3000/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
[vite] connected.
9:48:32 AM [vite] (client) [console.warn] You appear to have multiple instances of Solid. This can lead to unexpected behavior.
9:48:32 AM [vite] (client) [console.warn] You appear to have multiple instances of Solid. This can lead to unexpected behavior.
9:48:32 AM [vite] (client) [console.warn] computations created outside a `createRoot` or `render` will never be disposed
9:48:32 AM [vite] (client) [console.warn] computations created outside a `createRoot` or `render` will never be disposed
9:48:32 AM [vite] (client) [console.warn] cleanups created outside a `createRoot` or `render` will never be run
9:48:32 AM [vite] (client) [console.warn] computations created outside a `createRoot` or `render` will never be disposed
9:48:32 AM [vite] (client) [console.warn] computations created outside a `createRoot` or `render` will never be disposed
9:48:32 AM [vite] (client) [console.warn] cleanups created outside a `createRoot` or `render` will never be run
9:48:32 AM [vite] (client) [console.warn] computations created outside a `createRoot` or `render` will never be disposed
9:48:32 AM [vite] (client) [console.warn] cleanups created outside a `createRoot` or `render` will never be run
9:48:32 AM [vite] (client) [console.warn] cleanups created outside a `createRoot` or `render` will never be run
9:48:32 AM [vite] (client) [console.warn] computations created outside a `createRoot` or `render` will never be disposed

These warnings do not appear with Vite 7 using the exact same dependencies and configuration.

Steps to reproduce:

  1. Clone the repro repo and install dependencies:
    git clone https://github.com/abed-daloopa/tanstack-devtools-solid-warnings
    cd tanstack-devtools-solid-warnings
    bun install
  2. Run the dev server:
    bun run dev
  3. Open http://localhost:3000 — warnings appear in the browser console and terminal.

To verify Vite 8 is the cause, downgrade to Vite 7:

- "vite": "^8.0.3"
+ "vite": "^7.3.1"

Or add resolve.dedupe: ["solid-js"] to vite config

Reinstall and run ➡︎ warnings disappear.

Root cause: Vite 8 resolves Solid.js as multiple instances at runtime, even when only one copy exists in node_modules. Vite correctly deduplicates it.

Note: Adding resolve.dedupe: ["solid-js"] to the Vite config fixes the issue.

https://github.com/abed-daloopa/tanstack-devtools-solid-warnings

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

Maybe

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
  1. @tanstack/devtools-vite already has a config() hook at src/plugin.ts (@tanstack/devtools:config) that currently does nothing during serve mode (just returns). A minimal fix would be to return resolve.dedupe from it so Vite 8 collapses all solid-js imports into a single instance:

      {
        name: "@tanstack/devtools:config",
        enforce: "pre",
        config(_, { command }) {
          if (command !== "serve") {
            return;
          }
          return {
            resolve: {
              dedupe: ["solid-js"],
            },
          };
        },
      },
    

    If looks good will make PR for it

  2. have been having some issue today though after updating deps on project

  3. Another issue with Vite 8 (not sure what the cause exactly)

    I have to add devtools({ consolePiping: { enabled: false } }) to the vite config or I will get spammed by an infinte number of messages whenever an error happens

  4. I've had this spam reported if serving bun run dev from a terminal within ide (e.g. cursor, vscode). But doesn't seem to occur in terminal apps (e.g. terminal, iterm2, ghostty). However, error spam is strong enough to freeze dev environment.

  5. Seems to be caused by the following flow:

    1. Vite 8 loading in 2 Solid.Js instances
    2. Solid code execution fires multiple instances warning
    3. consolePiping grabs it and POSTS to /_tsd/console-pipe
    4. devtool server receives it and sends to panel
    5. panel is built with Solid causing another code execution (loop restarts)

    could use a guard to prevent repeated calls.

    @abed-daloopa when enabling dedupe for solidJS did you still have the infinite errors?

  6. abed-daloopa(GitHub profile, opens in a new tab)commented

    when enabling dedupe for solidJS did you still have the infinite errors?

    This issue is unrelated to the Solid.Js multiple instances problem.

    Even when adding dedupe: ["solid-js"]

    If any other error happens, I get spammed if i don't set { consolePiping: { enabled: false } }

    Note: I am running bun run dev inside Cursor's integrated terminal

Sign in to join this conversation.