Description
Describe the bug
In certain conditions, using $inspect will break reactivity of a component - making it no longer react to changes on a $state variable.
In our application we have a "hook-like" fetching system that is used by some components that can not be fed with data from the load-files (page.ts/layout.ts).
However, we want to make sure these components can still use the invalidate() logic of svelte, so we have created a small fetch-helper-hooklike-lib for this.
Using these "fetch-hooks" returns a class instance, with an internal property $state - that can then be updated later when fetching is complete or when it is invalidated.
These all works well and fine until we try to use $inspect on these internal $state-properties. The behaviour is very strange - the values seems to stop updating completely when inspected.
I have included a REPL that illustrates this issue. Try re-enabling the $inspect on line 16 of App.svelte to see how the app breaks.
Reproduction
Logs
No response
System Info
System:
OS: macOS 14.5
CPU: (10) arm64 Apple M2 Pro
Memory: 4.93 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.16.0 - ~/.nvm/versions/node/v20.16.0/bin/node
npm: 10.8.1 - ~/.nvm/versions/node/v20.16.0/bin/npm
Browsers:
Chrome: 127.0.6533.100
Safari: 17.5
npmPackages:
svelte: ^5.0.0-next.201 => 5.0.0-next.201
Severity
blocking an upgrade