Skip to content

Calling ns.remove(node) on renamed nodes does not work. #2016

Open
@runeh

Description

@runeh

protobuf.js version: 7.3.2 and newer.

Steps to reproduce:

  • Find a Type object in the tree: const myType = ns.lookupType('.MyType')
  • Change its name: myType.name = "NewName"
  • Remove the type from the parent: myType.parent.remove(myType)

Expected:

  • The type is removed from the parent, and no longer in the nestedArray property

Actual:

  • The type is still a child of the parent

I've added a test in a fork: runeh@a04e6ea

I assume it's due to this line:

delete this.nested[object.name];

The remove code assumes that the name will not have changed between the node being added and removed.

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