Skip to content

[crash] Can't find variable: onDestroy #78

Closed

Description

@broisnischal

Description

The app hit an unexpected error and showed the recovery screen.

Error details

AiSettingsDialog@http://localhost:1420/src/lib/components/AiSettingsDialog.svelte:451:11
@http://localhost:1420/node_modules/.vite/deps/client-B1YgD9dQ.js:698:71
update_reaction@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4885:18
update_effect@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4985:33
create_effect@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4310:17
@http://localhost:1420/node_modules/.vite/deps/client-B1YgD9dQ.js:695:19
update_reaction@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4885:18
update_effect@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4985:33
create_effect@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4310:17
block@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4500:28
wrapper@http://localhost:1420/node_modules/.vite/deps/client-B1YgD9dQ.js:689:8
add_svelte_meta@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:978:18
StudioShell@http://localhost:1420/src/lib/components/StudioShell.svelte:7796:19
@http://localhost:1420/node_modules/.vite/deps/client-B1YgD9dQ.js:698:71
update_reaction@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4885:18
update_effect@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4985:33
create_effect@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4310:17
@http://localhost:1420/node_modules/.vite/deps/client-B1YgD9dQ.js:695:19
update_reaction@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4885:18
update_effect@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4985:33
create_effect@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4310:17
block@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4500:28
wrapper@http://localhost:1420/node_modules/.vite/deps/client-B1YgD9dQ.js:689:8
add_svelte_meta@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:978:18
@http://localhost:1420/src/App.svelte:148:25
snippet@http://localhost:1420/node_modules/.vite/deps/client-B1YgD9dQ.js:233:13
update_reaction@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4885:18
update_effect@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4985:33
create_effect@http://localhost:1420/node_modules/.vite/deps/runtime-DY7OeTBY.js:4310:17
ensure@http://localhost:1420/node_modules/.vite/deps/client-B1YgD9dQ.js:187:40
@http://l

Steps to reproduce

Expected behavior


App version: 1.20.0
Platform: macOS
Reported via: in-app

Activity

  1. broisnischal commented on Aug 8, 2026

    @broisnischal
    CollaboratorAuthor

    Fixed in fe6820e2 on #75.

    I introduced this in the previous commit — an onDestroy handler whose import never landed. Opening AI settings then took the whole app down.

    Worth recording why it shipped: nothing in the toolchain catches it. Svelte compiles an unimported lifecycle call as a free variable and emits it verbatim, vite build succeeds, and svelte-check reports zero errors — I verified that against a probe file, because these script blocks are plain JS with no checkJs. It only fails on mount.

    So alongside the fix there's now a test that scans every .svelte file for calls to Svelte's runtime API (onMount, onDestroy, tick, untrack, getContext, mount/unmount, …) that the file never imports. Confirmed by removing the import again — the suite names the file and the symbol.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions