Skip to content

Commit 560cbec

Browse files
ryansolidclaudeAlemTuzlak
authored
feat: move the devtools to Solid 2 (#563)
* feat: move the devtools to Solid 2 The shell (@tanstack/devtools), devtools-ui and devtools-a11y now render with their own copy of Solid 2 (solid-js and @solidjs/web rc.21+) and drop the solid-js peer, so framework adapters other than Solid are unaffected. @tanstack/solid-devtools and devtools-utils/solid peer on Solid 2. Port notes: effects are split into compute and apply; props are read through `props` (no destructuring) and create-time reads are untracked; store setters write drafts and reconcile layouts; contexts have no default and render as `<Context value>`; `classList`, `on:` and `Index` are replaced; aria booleans are strings. @neodrag/solid has no Solid 2 build, so sortable lists use @neodrag/core directly. The shell and class-based panels load their chunk through a signal instead of `lazy`, so neither needs a Loading boundary. tsup builds compile JSX with @solidjs/babel-plugin (scripts/tsup-solid-v2.ts). Tests flush after DOM events and timer callbacks, since Solid 2 applies writes on the next flush. The devtools bundle size limit moves from 67 KB to 85 KB: the Solid 2 runtime accounts for the whole increase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMMJ6aTSA3MvtgJWG2 * chore(devtools): move to Solid 2.0 stable Bump solid-js, @solidjs/* and Solid 2 primitives off their rc/next tags onto the stable releases (solid-js ^2.0.0, @solidjs/vite-plugin ^3.0.0) and set the solid-js peer to ^2.0.0. Where the repo enforces minimumReleaseAge, the 2.0.0 packages are listed in minimumReleaseAgeExclude until they age past it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWL7JwK3aqy95RDD2WN * fix(devtools): read props and settings in tracked scopes instead of untrack The Solid 2 port used untrack to quiet STRICT_READ_UNTRACKED. Most of those reads froze values that can change: - JsonTree branched on props.value at creation, so an array or object that changed in place (a store) kept rendering [] / {}. It now uses Show/Switch and a keys memo; expansion defaults are writable derived signals. - Trigger corner/edge and the panel's open state derive from settings; the placement effect tracks the stored spot and leaves gestures alone. - Lazy shell/panel components render through keyed Show. - The plugin title renders from its effect, not the ref. - createSortable creates its list from an effect that tracks the node and options. - solid-devtools creates the core at mount. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWKxztQH1DynW6X2DK1 * fix(devtools): bundle Solid into the core so the app's Solid cannot change it In a Solid 1 app, vite-plugin-solid gives every package the app's copy of solid-js. The core then loaded Solid 1 for its Solid 2 code, and the Vite dev server stopped with "./internal is not exported". The core now bundles the production build of Solid 2, @solid-primitives and devtools-ui, so it has no runtime solid-js import. This also removes the Solid 2 dev warnings (more than 100 in the React example) that the core printed in every app's console. The devtools-ui fonts are copied to dist/assets, because their relative URL is wrong once the module is bundled. * feat(solid-devtools): support Solid 1 and Solid 2 apps The adapter now uses only the solid-js APIs that both versions have, and no JSX. A small helper runs effects with the Solid 2 compute/apply split or the Solid 1 single function. Plugin content is resolved with children() and put into the mount node, so no @solidjs/web or solid-js/web import is needed. The component renders nothing and mounts the shell into <body> from an effect. Effects do not run on the server, so the clientOnly wrapper is gone and server and client output match. The peer range is now solid-js ^1.9.13 || ^2.0.0. Update the docs and the changeset to match. * chore: deny the @google/genai install script so CI installs pass The lockfile now has @google/genai 2.32.0, which has a preinstall script that only echoes "no-op". pnpm 11 stops the install for build scripts that allowBuilds does not list, so every CI job failed at setup. * test(e2e): add a Solid 1 app for @tanstack/solid-devtools The app uses solid-js 1.9 and vite-plugin-solid 2, so every package gets the app's Solid 1. The test opens the devtools, then clicks a Solid 1 plugin and checks that its text updates. Sherif now skips the solid-js version check, because the repo has Solid 1 and Solid 2 apps on purpose. * fix(devtools): stop installing the bundled Solid packages The core bundles solid-js, @solidjs/web, @solid-primitives and devtools-ui, so they move to devDependencies. Apps no longer install Solid 2, which needs Node 22.12. TabName and TanStackDevtoolsTheme are written out, so the public types do not import those packages. devtools-ui and devtools-a11y still depend on Solid 2, so their engines now say Node 22.12 or later. The font copy in the build skips a file that the other build (prod or dev) wrote already. On Windows the two copies failed with EBUSY. * fix(solid-devtools): keep plugin nodes attached and dispose closed panes - Plugin nodes go into the pane before the plugin's onMount runs. - Updates move or remove only the nodes that changed, so an input next to changing text keeps its focus. - Closing a pane disposes the plugin's root and still calls the plugin's own destroy. - The element type no longer erases the types of render callbacks. The Solid 1 and Solid 2 e2e apps test these three behaviors. * fix: handle the open review comments on the Solid 2 port - setStore saves only the sections an update returns, merged with the saved values, so a state-only update keeps the saved settings. - replaceLayout saves the new layout. Before, it saved the store before the write was committed, so the old layout. - A devtools-utils Solid panel that fails to load logs the error. Before, the rejection was unhandled. - The quick start and the a11y docs say which Solid versions work. - The SolidStart example README uses `pnpm install --ignore-workspace`, because the example is outside the workspace. --------- Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Alem Tuzlak <t.zlak@hotmail.com>
1 parent 8648af9 commit 560cbec

125 files changed

Lines changed: 3095 additions & 4617 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.changeset/devtools-solid-2.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@tanstack/devtools': minor
3+
'@tanstack/devtools-ui': minor
4+
'@tanstack/devtools-a11y': minor
5+
'@tanstack/devtools-utils': minor
6+
'@tanstack/solid-devtools': minor
7+
---
8+
9+
Move the devtools to Solid 2.
10+
11+
- `@tanstack/devtools` bundles its own production copy of Solid 2. It works the same in React, Vue, Svelte, Angular, Preact, Solid 1 and Solid 2 apps, and it adds no Solid warnings to the app's console. It no longer installs `solid-js`, `@solidjs/web` or `@tanstack/devtools-ui`.
12+
- `@tanstack/solid-devtools` works in Solid 1 (`solid-js` 1.9.13 or later) and Solid 2 apps.
13+
- `@tanstack/devtools-ui`, `@tanstack/devtools-a11y` and `@tanstack/devtools-utils/solid` use Solid 2 (`solid-js` and `@solidjs/web` 2.0.0 or later). In a Solid 1 app built with `vite-plugin-solid`, these versions stop the dev server, because the plugin gives every package the app's copy of `solid-js`. Solid 1 apps stay on `@tanstack/devtools-a11y` 0.2.x and `@tanstack/devtools-utils` 0.7.x.
14+
- `@tanstack/devtools-ui` and `@tanstack/devtools-a11y` need Node 22.12 or later, the same as Solid 2.
15+
- Panels built on `@tanstack/devtools-ui` 0.7.x keep working in React and Solid 1 apps. Moving a panel to `@tanstack/devtools-ui` 0.8 means moving it to Solid 2.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tanstack/devtools-vite': patch
3+
---
4+
5+
Detect Solid 2 entry files, which render from `@solidjs/web`, when injecting console piping.

‎docs/devtools-utils.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ const [MyPlugin, NoOpPlugin] = createSolidPlugin({
210210

211211
### createSolidPanel
212212

213-
Solid also provides a class-based panel factory. It uses `createSignal` and `onMount`/`onCleanup` instead of React hooks:
213+
Solid also provides a class-based panel factory. It creates the core instance once, mounts it in `onSettled`, and unmounts it from the cleanup that `onSettled` returns:
214214

215215
```ts
216216
import { createSolidPanel } from '@tanstack/devtools-utils/solid'

‎docs/framework/solid/adapter.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ If you are using TanStack Devtools in a Solid application, we recommend using th
1111
npm install -D @tanstack/solid-devtools
1212
```
1313

14+
`@tanstack/solid-devtools` works with Solid 1 (`solid-js` 1.9.13 or later) and Solid 2.
15+
1416
## Solid Hooks
1517

1618
TODO

‎docs/framework/solid/basic-setup.md‎

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,25 @@ Install the [TanStack Devtools](https://www.npmjs.com/package/@tanstack/solid-de
1313
npm i -D @tanstack/solid-devtools
1414
```
1515

16+
The Solid adapter works with Solid 1 (`solid-js` 1.9.13 or later) and Solid 2. The examples below use Solid 2. In a Solid 1 app, import `render` from `solid-js/web`.
17+
1618
Next in the root of your application import the `TanStackDevtools` from the required framework adapter (in this case @tanstack/solid-devtools).
1719

1820
```tsx
21+
import { render } from '@solidjs/web'
1922
import { TanStackDevtools } from '@tanstack/solid-devtools'
2023

2124
import App from './App'
2225

23-
createRoot(document.getElementById('root')!).render(
24-
<StrictMode>
25-
<App />
26+
render(
27+
() => (
28+
<>
29+
<App />
2630

27-
<TanStackDevtools />
28-
</StrictMode>,
31+
<TanStackDevtools />
32+
</>
33+
),
34+
document.getElementById('root')!,
2935
)
3036
```
3137

@@ -38,7 +44,7 @@ Currently TanStack offers:
3844
- `FormDevtools`
3945

4046
```tsx
41-
import { render } from 'solid-js/web';
47+
import { render } from '@solidjs/web';
4248

4349
import { TanStackDevtools } from '@tanstack/solid-devtools'
4450

‎docs/framework/solid/guides/custom-plugins.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ This step follows what's shown in [basic-setup](../basic-setup) for a more docum
139139

140140
index.tsx
141141
```tsx
142-
import { render } from 'solid-js/web'
142+
import { render } from '@solidjs/web'
143143
import { TanStackDevtools } from '@tanstack/solid-devtools'
144144
import { DevtoolPanel } from './DevtoolPanel'
145145

‎docs/plugins/a11y.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ createRoot(document.getElementById('root')!).render(
4444

4545
## Quick Start (Solid)
4646

47+
This version of the plugin needs Solid 2. In a Solid 1 app, use `@tanstack/devtools-a11y` 0.2.x.
48+
4749
```tsx
48-
import { render } from 'solid-js/web'
50+
import { render } from '@solidjs/web'
4951
import { TanStackDevtools } from '@tanstack/solid-devtools'
5052
import { a11yDevtoolsPlugin } from '@tanstack/devtools-a11y/solid'
5153

‎docs/quick-start.md‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ render(
111111

112112
## Solid
113113

114+
`@tanstack/solid-devtools` works in Solid 1 (`solid-js` 1.9.13 or later) and Solid 2 apps. The example below uses Solid 2. In a Solid 1 app, import `render` from `solid-js/web`.
115+
114116
Install the devtools and the Vite plugin:
115117

116118
```bash
@@ -120,7 +122,7 @@ npm install -D @tanstack/solid-devtools @tanstack/devtools-vite
120122
Add the `TanStackDevtools` component using Solid's `render(() => ...)` pattern:
121123

122124
```tsx
123-
import { render } from 'solid-js/web'
125+
import { render } from '@solidjs/web'
124126
import { TanStackDevtools } from '@tanstack/solid-devtools'
125127

126128
import App from './App'
@@ -136,7 +138,7 @@ render(() => (
136138
To add plugins, pass them via the `plugins` prop:
137139

138140
```tsx
139-
import { render } from 'solid-js/web'
141+
import { render } from '@solidjs/web'
140142
import { TanStackDevtools } from '@tanstack/solid-devtools'
141143
import { SolidQueryDevtoolsPanel } from '@tanstack/solid-query-devtools'
142144
import { TanStackRouterDevtoolsPanel } from '@tanstack/solid-router-devtools'

‎e2e/apps/solid/package.json‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@
1010
"test:e2e": "playwright test"
1111
},
1212
"dependencies": {
13+
"@solidjs/web": "^2.0.0",
1314
"@tanstack/devtools-e2e": "workspace:*",
1415
"@tanstack/solid-devtools": "workspace:*",
15-
"solid-js": "^1.9.13"
16+
"solid-js": "^2.0.0"
1617
},
1718
"devDependencies": {
1819
"@playwright/test": "^1.49.0",
20+
"@solidjs/vite-plugin": "^3.0.0",
1921
"@tanstack/devtools-vite": "workspace:*",
2022
"typescript": "~5.9.2",
21-
"vite": "^8.0.0",
22-
"vite-plugin-solid": "^2.11.11"
23+
"vite": "^8.0.0"
2324
}
2425
}

‎e2e/apps/solid/src/index.tsx‎

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,40 @@
1-
import { render } from 'solid-js/web'
1+
import { createSignal, onCleanup, onSettled } from 'solid-js'
2+
import { render } from '@solidjs/web'
23
import { TanStackDevtools } from '@tanstack/solid-devtools'
34

5+
declare global {
6+
interface Window {
7+
demoPluginCleanedUp?: boolean
8+
demoPluginConnectedOnMount?: boolean
9+
}
10+
}
11+
412
function DemoPlugin() {
5-
return <div data-testid="demo-plugin">demo plugin content</div>
13+
const [count, setCount] = createSignal(0)
14+
const [text, setText] = createSignal('')
15+
let input!: HTMLInputElement
16+
// The plugin's nodes must be in the page when onSettled runs.
17+
onSettled(() => {
18+
window.demoPluginConnectedOnMount = input.isConnected
19+
})
20+
onCleanup(() => {
21+
window.demoPluginCleanedUp = true
22+
})
23+
return (
24+
<>
25+
<button data-testid="demo-plugin" onClick={() => setCount(count() + 1)}>
26+
clicks: {count()}
27+
</button>
28+
<input
29+
ref={input}
30+
aria-label="Search"
31+
data-testid="demo-input"
32+
onInput={(event) => setText(event.currentTarget.value)}
33+
/>
34+
{/* A sibling that changes on each key press. */}
35+
{text()}
36+
</>
37+
)
638
}
739

840
function App() {
@@ -12,8 +44,9 @@ function App() {
1244
<TanStackDevtools
1345
plugins={[
1446
{
47+
id: 'demo',
1548
name: 'Demo',
16-
render: <DemoPlugin />,
49+
render: () => <DemoPlugin />,
1750
},
1851
]}
1952
/>

0 commit comments

Comments
 (0)