-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Export symbol STATE_SYMBOL
or register it globally
#15908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
It's safe to use Other than that this is a duplicate of #15345 But it should probably be documented that |
Yes, but we would like to determine this outside of the svelte world, since our message passing logic happens in pure typescript and we don't have (and don't want) access to svelte there. |
But why leak Svelte logic into the outside world at all? Why not make the Svelte part responsible for passing proper data to the outside world? |
I want to revoke that sentence. Svelte will clone anything, even if it's not a |
I also would like to understand the problem better. You're saying your outside-TS logic should have no knowledge of Svelte at all, but using something like |
It kind of seems like a brittle approach to me to expect the developers to always call
Additionally, |
To add to the previous comment: Let's say we have an object with the following interface: interface Foo {
type: "foo" | "bar";
blob: Promise<Blob | undefined>;
baz: Writable<boolean>;
} If an instance of such an object is used in a We would like to have the possibility to control the snapshot logic ourselves, so that we can ensure that it matches the one we use for the transfer logic. Side note: We currently just use |
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 withsnapshot
. 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 (usingSymbol.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
The text was updated successfully, but these errors were encountered: