Skip to content

fix(devtools): depend on the stable nanoviews and keep the panel off with a production core - #304

Merged
dangreen merged 1 commit into
mainfrom
fix/devtools-stable-nanoviews
Oct 21, 2026
Merged

dangreen merged 1 commit into
mainfrom
fix/devtools-stable-nanoviews

Conversation

@dangreen

Copy link
Copy Markdown
Member

Why

@nano_kit/devtools@2.0.0 cannot be used outside this repository. It pins nanoviews@1.0.0-prerelease.20260923175652, which pins kida@2.0.0-prerelease.20260919114914, so an app with @nano_kit/store@2.0.0 installs a second kida, and a Vite build fails right away: "text" is not exported by "node_modules/nanoviews/dist/store.js", since that kida prerelease still named the template tag f. The workspace never shows it: its overrides hand nanoviews the workspace kida.

Once the build passes, a second problem shows: devtools() against a production core hangs the page, as in a production build that calls it unguarded. onSignal fires in every build, while the mark that keeps the nodes of the panel out, UninspectedMode set inside uninspected, exists in the development build of the core alone. With a production core every signal the panel creates for its records comes back through onSignal as a node of the application, the registry records it, and the microtasks never end.

What

  • nanoviews, @nanoviews/storybook, @nanoviews/storybook-vite and @nanoviews/testing-library at ^1.0.0. The stable nanoviews depends on kida ^2.0.0, so an app gets one kida. The lockfile holds only nanoviews@1.0.0, and kida and agera stay linked to the workspace.
  • devtools() first creates a signal inside uninspected and checks that the core marked it. A production core does not: the function warns that devtools() belongs to development, with the development condition resolved, and returns, so the panel stays off instead of recording itself. onSignal stays as it is in the core: @nano_kit/svelte needs it in production.
  • The comment on the overrides in pnpm-workspace.yaml no longer speaks of kida snapshots.

Size

dist/index.js grows by 288 B raw and 110 B gzip against the published 2.0.0, the warning mostly. A call behind import.meta.env.DEV, as the README shows, still ships nothing: the production bundle of the probe app is 5.16 kB with no code of the panel.

Notes

  • Checked in a separate app against a tarball of this branch, with @nano_kit/store@2.0.0 from npm, Vite 8.2.1 and no overrides: one kida; in vite dev the panel mounts with no errors; in a production build an unguarded call warns and the page stays responsive; a guarded call leaves nothing of the panel in the bundle.
  • Lint, tsc, the 249 specs and the build of devtools pass, and so does storybook:build on the @nanoviews/* 1.0.0 packages. The entry has no spec: it imports the styles that only the library build makes.
  • Until 2.0.1 is out, an app can force the stable nanoviews through overrides ("nanoviews": "^1.0.0").

…with a production core

The 2.0.0 panel pinned a nanoviews prerelease that brings its own kida prerelease, so an app got a second kida and its build failed on the missing `text` export. `nanoviews` and the `@nanoviews/*` packages are taken at `^1.0.0` now.

With a production core, as in a production build that calls `devtools()` unguarded, the page hung: such a core marks no node of the panel, `onSignal` handed the registry every node the panel created for its records, and the panel recorded itself without end. `devtools()` now checks that the core marks a node created inside `uninspected`, and otherwise warns and stays off.
@codecov

codecov Bot commented Oct 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.62%. Comparing base (f4b29d6) to head (cbabc20).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #304   +/-   ##
=======================================
  Coverage   83.62%   83.62%           
=======================================
  Files         228      228           
  Lines        4849     4849           
  Branches     1074     1074           
=======================================
  Hits         4055     4055           
  Misses        553      553           
  Partials      241      241           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dangreen
dangreen merged commit c599764 into main Oct 21, 2026
11 checks passed
@dangreen
dangreen deleted the fix/devtools-stable-nanoviews branch October 21, 2026 14:47
@github-actions github-actions Bot mentioned this pull request Oct 21, 2026
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

Successfully merging this pull request may close these issues.

1 participant