Closed MartkCz closed 3 weeks ago
What is the {xxx.xxx}
all about? It's likely that the error is causing the problem you're seeing.
I think that's intentional - the report is that Svelte doesn't recover well from runtime errors like this. Which I don't think there's a lot that can be done about until we implement error boundaries, correct?
It's just to simulate an error. I can change it to:
<script>
let { need } = $$props;
let promise = fetch('https://jsonplaceholder.typicode.com/todos/1');
</script>
{#await promise}
{:then value}
{value.obj.value}
{:catch error}
{error}
{/await}
same result. It breaks all components on the website, which isn't ideal for production.
@trueadm the problem is that after the first error that happens during rendering of the then block every change is throwing state_unsafe_mutation
.
This is because of point number 1 here:
true
we set the active reaction, then we run the block effect for the then function and then we restore back...but if the then function throws we never restore it back (i already fixed this with a try finally<input oninput={(e)=>term = e.target.value} value={term} />
instead of binding value the subsequent errors are not there so i suspect there's also something funky going on with bind value@trueadm the problem is that after the first error that happens during rendering of the then block every change is throwing
state_unsafe_mutation
.This is because of point number 1 here:
- inside the await block if we have restore
true
we set the active reaction, then we run the block effect for the then function and then we restore back...but if the then function throws we never restore it back (i already fixed this with a try finally- However if you do
<input oninput={(e)=>term = e.target.value} value={term} />
instead of binding value the subsequent errors are not there so i suspect there's also something funky going on with bind value
Ohhh this is because bind:value it's adding an event listener normally so it's not deferred.
Nice find!
Nice find!
Should we change bind:value
too? I think it's fine if it adds the listener normally right?
it just needs to use on
internally, no?
it just needs to use
on
internally, no?
Yeah exactly
@paoloricciuti Are you doing that now or should we create an issue for it?
@paoloricciuti Are you doing that now or should we create an issue for it?
I can do it probably In a bit
I've already got a PR incoming :)
Describe the bug
It seems like Svelte gets stuck in an effect state.
Reproduction
https://svelte.dev/playground/6fbbf69c47894154bfa37c9fb83e7ac0?version=5.1.11
Type something in the text input
Logs
No response
System Info
Severity
annoyance