Component Duplication Upon Dev Server Reload

Open
#202 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
javascript, vite
Domain
frontend, tooling

Research direction

Reproduce the issue with the App.jsx and index.jsx reload sequence, using the configuration shown in vite.config.js and the listed Solid/Vite dependencies. Start by checking whether saving a non-index.jsx file duplicates routed components, and consider the issue done when repeated hot reloads leave the component tree rendered only once.

Written by the indexing model from the issue text.

Description

need reproduction
Image

After triggering hot reload from App.jsx 3 times.

Image

After subsequently triggering hot reload from index.jsx once.

  1. Created a new project using npx degit solidjs/templates/js my-app
  2. npm install
  3. npm i @solidjs/router
  4. npm run dev
  5. In index.jsx import { Route, Router } from '@solidjs/router';
  6. In index.jsx render( () =>( // <Router root={App} /> <Router> <Route path="/" component={App} /> <Route path="/projects" component={Projects} /> <Route path="/projects/:id" component={Project} /> </Router> ), root);
  7. npm run dev
  8. Trigger hot reload via saving VSCode file
  9. Observe component duplication every time hot reload triggers

Additional Considerations:

  • I do have tailwindcss vite plugin installed npm install tailwindcss @tailwindcss/vite

EDIT Having started a new project without tailwind, the duplication error still happens. It happens only when saving a file other than index.jsx. Saving index.jsx seems to work as expected with no duplication.

Environment:

  • Device: MacBook Pro
  • Chip: Apple M1 Max
  • macOS version: Sequoia 15.3.1
  • Chrome version: Version 133.0.6943.128 (Official Build) (arm64)

Dev Deps:

  • "vite": "^6.0.0"
  • "vite-plugin-solid": "^2.11.6"

Deps:

  • "@solidjs/router": "^0.15.3"
  • "@tailwindcss/vite": "^4.0.9"
  • "solid-js": "^1.9.5"
  • "tailwindcss": "^4.0.9"

vite.config.js
`import { defineConfig } from "vite";
import solidPlugin from "vite-plugin-solid";
import tailwindcss from "@tailwindcss/vite";

export default defineConfig({
plugins: [solidPlugin(), tailwindcss()],
server: {
port: 5173,
},
build: {
target: "esnext",
},
});
`

Dominant language
TypeScript
Stars
520
Forks
70
Avg merge
23h 35m
Merged PRs (30d)
39

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from solidjs/solid-vite-plugin

All issues in solidjs/solid-vite-plugin

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.