Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
runeh opened this issue Aug 16, 2024 · 0 comments
Open

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

runeh opened this issue Aug 16, 2024 · 0 comments

Comments

@runeh
Copy link

runeh commented Aug 16, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant