Skip to content

Replacing an id-less script by its synthetic location appends instead of replacing on the draft path #2799

Description

@bdraco

An id-less top level script: entry parses to a synthetic location (script_<index>), and _upsert_top_level_list matches list items by their id field, so a replace aimed at that synthetic id matches nothing and appends a duplicate instead. The guarded path (#2788, save or expected) refuses this after the fact; the editor's auto-apply path is unguarded by design (parse free per keystroke) and returns a success diff with the duplicate.

Fix belongs in the writer: resolve a synthetic script_<index> location positionally when no item carries that id, the way _require_instance already falls back to the parser's positional label for id-less component instances, so the replace lands on the row the parser listed.

Raised by esphbot on #2788.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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