Skip to content

$inspect.trace() is missing information or Svelte is running effects unnecessarily #14794

Closed
@webJose

Description

@webJose

Describe the bug

It seems that there might be room for improvement for $inspect.trace(). There are cases where the trace doesn't highlight anything as changed. If nothing really changed, then why did the effect fire, right?

My current possibilities are:

  1. The trace is correct, and no recorded signals really changed. Implication: There's a bug in Svelte that fires effects unnecessarily.
  2. The trace is incorrect, as a signal really did change. Implication: $inspect.trace() doesn't always show the signals that change, or its highlighting algorithm is sometimes failing to indicate which signals changed.

One possibility that occurs to me: The trace is shown after the effect runs, and it contains all the signals read during that execution. This list is then shown using data from before the effect run to show which signals made the effect fire to begin with by highlighting them in cornflower blue. The potential fail might come here: What if the run doesn't read the signal that made the effect fire? Then there's nothing to highlight.

Reproduction

REPL

Instructions

  1. Open REPL.
  2. Clear the console.
  3. Click the "Synchronize Columns" button.
  4. Examine the third trace: Nothing is highlighted blue.

Logs

No response

System Info

REPL

Severity

annoyance

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions