-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
binding_property_non_reactive error without location #12514
Comments
This is actually an issue with sveltekit and how the app is generated Here's a minimal repro in the repl ...the fix is simple but it needs to be in the sveltekit repo. Will PR soon |
@paoloricciuti It looks like |
Is kinda of a mix...the warn was introduction in svelte but it's a legit warn. However the generated component from svelte is using a prop with default value as a reactive value and since that PR that's not the case anymore. So the right fix is in sveltekit and not here. |
Same issue here, and I'm on svelte 5 next 195. And practical implications of this, or is it just an erroneous warning. |
The PR to sveltekit is still open. When it's merged this should be fixed once you update sveltekit and run sync |
Hello everyone. I am starting with Svelte 5 and I think I am using reactivity correctly. But I am not sure yet. Here is a class I created for handling an actor subscription from XState. // actor-subscription.svelte.ts
import { onDestroy } from 'svelte';
import type { AnyActorLogic, SnapshotFrom } from 'xstate';
import { createActor } from 'xstate';
export class ActorSubscription<TActorLogic extends AnyActorLogic> {
readonly actorRef: ReturnType<typeof createActor<TActorLogic>>;
readonly send: ReturnType<typeof createActor<TActorLogic>>['send'];
#snapshot: SnapshotFrom<ReturnType<typeof createActor<TActorLogic>>> = $state()!;
get snapshot() {
return this.#snapshot;
}
constructor(actorLogic: TActorLogic) {
this.actorRef = createActor(actorLogic);
this.send = this.actorRef.send;
this.#snapshot = this.actorRef.getSnapshot();
const subscription = this.actorRef.subscribe((snapshot) => {
this.#snapshot = snapshot;
});
onDestroy(subscription.unsubscribe);
this.actorRef.start();
}
} So, when I use the getter Any help is much appreciated. Thanks! |
Sorry but how is this related to this issue? Which error persist? |
Thank you, @paoloricciuti. What I meant to know is if this message is based on a wrongful evaluation of the property in question. From what I understood of the problem, the evaluation of a bound property may be wrong, meaning that a truly reactive property was wrongly deemed as non reactive. Hence the message. Or is this message unnecessary at all, meaning that even binding a non-reactive property should not cause this message? |
If you are referring to However the code you posted doesn't even feature a template. So where are you getting this error? Can you copy and paste the exact error (which should be a warning anyway) |
I think I understood the problem more clearly now, so it makes sense that you didn’t understand me first. |
Yes exactly: this specific warning is caused by sveltekit generated code: there's already a PR open to fix the issue, once that is merged you can just update sveltekit, sync again and be done with it. You are probably still safe to ignore this warning for the moment. |
Describe the bug
I'm getting the following error with the 192 release
The error doesn't contain any hint as to where it happened.
Please, could all error messages come with a filename and line number?
Reproduction
Update: you can reproduce this with
create svelte
(I selected only skeleton project, js only, and svelte 5 preview):the devtools console has two of these errors.
The only location a global search of my project found with the exact text was in
.svelte-kit/generated/root.svelte
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: