Deleting a nodeview only deletes contentDOM's children

this problem only happens when it is the only content in the doc

first of all, this is not a prosemirror bug. my other nodeviews are working fine. I have forked prosemirror-tables to add a little bit of code to the table nodeview and this problem started to happen.

the code below is the simplified version of my forked table nodeview.

export class TableView implements NodeView {
  public dom: HTMLDivElement;
  public table: HTMLTableElement;
  public colgroup: HTMLTableColElement;
  public contentDOM: HTMLTableSectionElement;

  constructor(public node: Node, public cellMinWidth: number, public wrapperClassNames: string[]) {
    this.dom = document.createElement('div');
    this.dom.className = 'tableWrapper';
    wrapperClassNames.forEach((className) => this.dom.classList.add(className))
    
    this.table = this.dom.appendChild(document.createElement('table'));
    this.table.className = node.attrs.class;
    
    this.colgroup = this.table.appendChild(document.createElement('colgroup'));
    
    updateColumnsOnResize(node, this.colgroup, this.table, cellMinWidth);
    
    this.contentDOM = this.table.appendChild(document.createElement('tbody'));
  }

  update(node: Node): boolean {
    *******my_code_starting_here*******
    if (node.attrs !== this.node.attrs) { 
      this.node = node
      this.table.className = node.attrs.class
      return true
    }
    *******ends*******
    if (node.type != this.node.type) return false; 
    this.node = node;
    updateColumnsOnResize(node, this.colgroup, this.table, this.cellMinWidth);
    return true;
  }

  ignoreMutation(record: MutationRecord): boolean {
    return (
      record.type == 'attributes' &&
      (record.target == this.table || this.colgroup.contains(record.target))
    );
  }
}

when i select the node and press backspace to delete, this.dom & this.contentDOM remains in the editing field. the node which is the children of the this.contentDOM is deleted though.

in the pm-dev-tools, i can see that the deleted node is replaced to an empty paragraph node. but what’s shown on the editor is the broken node that should have been already deleted.

any advice is welcome!

Does putting your attrs check after the type check help?

it helped. the problem is gone. what exactly does comparing node.type do? i looked up the docs but couldn’t find any info.