mirror of https://github.com/sveltejs/svelte
feat: add infinite loop effect callstack (#13231)
This adds a new dev-time only `dev_effect_stack` variable, which executed effects are pushed to and eventually cleared out after everything's settled. If it doesn't settle however, i.e. you run into an infinite loop, the last ten effects are printed out so you get an idea where the error is coming from. For proper source mapping I also had add location info to the generated effects. Closes #13192pull/13228/head
parent
e5c840c87b
commit
a6df4ebfcc
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
feat: add infinite loop effect callstack
|
@ -0,0 +1,9 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
client: [
|
||||
{ str: '$effect.pre', strGenerated: '$.user_pre_effect' },
|
||||
{ str: '$effect', strGenerated: '$.user_effect' }
|
||||
],
|
||||
server: []
|
||||
});
|
@ -0,0 +1,9 @@
|
||||
<script lang="ts">
|
||||
$effect(() => {
|
||||
foo;
|
||||
});
|
||||
|
||||
$effect.pre(() => {
|
||||
bar;
|
||||
});
|
||||
</script>
|
Loading…
Reference in new issue