Description
Describe the problem
In our application, we use MessageChannels to communicate with workers. Svelte 5 in rune mode proxies variables declared with $state
. Such proxied variables cannot be sent through the message passing system without unpacking them with snapshot
. However, there is no way to figure out programatically whether or not a value given to the message passing system is such a proxy. The only way is trial and error, to see whether or not the message passing system fails at runtime.
Describe the proposed solution
We saw that you use a special symbol for such Proxies, i.e STATE_SYMBOL
. We would like to have it exported or registered globally (using Symbol.for
), so that we have a way of checking whether or not a variable was proxied by svelte, so we may unpack it before sending it through the Channels.
If this is not a viable solution for you, could you explain how it is possible to detect such proxies programatically?
Importance
i cannot use svelte without it