GithubHelp home page GithubHelp logo

Comments (2)

Domiii avatar Domiii commented on May 29, 2024

Problem not being reported is a problem with VSCode. It is most likely happening after we returned newly created nodes from BaseTreeViewNodeProvider.getChildren, and VSCode is unable to add them and the error is not thrown and just gobbled up. VSCode should log this properly or throw an error when calling _onDidChangeTreeData.fire() which is the ultimate caller of a tree refresh (the latter probably cannot happen because it is probably an asynchronous action). Issue has been causing quite a lot of unhappiness and (probably incorrectly) marked as resolved in microsoft/vscode#71698.

While this is a general VSCode problem, it still hints at a bug in our code.

That bug is caused by our node id generation not generating unique node ids here:

  makeNodeId(nodeClassName, parent, i) {
    return [parent?.id || '', nodeClassName, i].join('..');
  }

Specifically, in production, nodeClassName is null or undefined or empty string, causing trouble.

from dbux.

Domiii avatar Domiii commented on May 29, 2024

Fixed by generating a unique id for each NodeClass and use that instead of (in addition to) just the name:

const nodeClasses = new Map();

function makeNodeClassId(NodeClass) {
  // in production, names get mangled and/or removed entirely, so we need a different class identifier here
  let id = nodeClasses.get(NodeClass);
  if (!id) {
    id = nodeClasses.size + 1;
    nodeClasses.set(NodeClass, id);
  }
  
  return (NodeClass.name || '') + id;
}

from dbux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.