Skip to content

Better effect stack loggingΒ #13256

@Rich-Harris

Description

@Rich-Harris

Describe the problem

See #13231 (comment)

Describe the proposed solution

Attach location information to effects in development, so that it can be used when generating the error message. For simple cases where there's only a single effect involved we can do this sort of thing:

Uncaught Svelte error: effect_update_depth_exceeded
Maximum update depth exceeded in App.svelte:3:1. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops

If there are multiple effects running in a loop, the message could be more like this...

Uncaught Svelte error: effect_update_depth_exceeded
Maximum update depth exceeded. This can happen when a reactive block or effect repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops. Last ten effects:

App.svelte:3:1
App.svelte:10:1
App.svelte:3:1
App.svelte:10:1
App.svelte:3:1
App.svelte:10:1
App.svelte:3:1
App.svelte:10:1
App.svelte:3:1
App.svelte:10:1

...or we could try and be smarter about it so that we identify the actual loop (which aside from truly pathological cases should just be a case of going back until we see the most recent effect earlier in the stack?)

Importance

nice to have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions