Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-6188

Grid view: can't cancel editing document when a field previously missing is set

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • No version
    • Affects Version/s: None
    • Component/s: CRUD, Table View
    • None
    • Environment:
      OS:
      node.js / npm versions:
      Additional info:
    • Not Needed

      Steps to reproduce:
      1 - open a collection with documents where a property is present only on some (for example: Corporate-Registrations.agent_city in Compass).
      2 - switch to the table view
      3 - edit a row
      4 - click on a missing property
      (a cell with "No Field")
      5 - click cancel

      Cancel would fail, and an error is thrown:

      Cannot read properties of undefined (reading 'elements')
      
      Call Stack
       Element.revert
        MongoDBCompass/../hadron-document/src/element.ts:716:19
       CellEditor.isCancelAfterEnd
        MongoDBCompass/../compass-crud/src/components/table-view/cell-editor.jsx:288:22
       LegacyReactComponent.BaseReactComponent.callMethod
        MongoDBCompass/../../node_modules/ag-grid-react/lib/baseReactComponent.js:25:27
       LegacyReactComponent.eval [as isCancelAfterEnd]
        MongoDBCompass/../../node_modules/ag-grid-community/dist/lib/components/framework/frameworkComponentWrapper.js:30:32
       CellComp.stopEditing
        MongoDBCompass/../../node_modules/ag-grid-community/dist/lib/rendering/cellComp.js:1503:89
       eval
        MongoDBCompass/../../node_modules/ag-grid-community/dist/lib/rendering/rowComp.js:826:26
       eval
        MongoDBCompass/../../node_modules/ag-grid-community/dist/lib/rendering/rowComp.js:869:13
       Function.Utils.iterateObject
        MongoDBCompass/../../node_modules/ag-grid-community/dist/lib/utils.js:206:17
       RowComp.forEachCellComp
        MongoDBCompass/../../node_modules/ag-grid-community/dist/lib/rendering/rowComp.js:865:19
       RowComp.stopEditing
        MongoDBCompass/../../node_modules/ag-grid-community/dist/lib/rendering/rowComp.js:825:14
      

      The error points to this line: https://github.com/mongodb-js/compass/blob/56203bbd83efb59fd611bbc81d2e0cb330aaeebd/packages/hadron-document/src/element.ts#L685

            Assignee:
            Unassigned Unassigned
            Reporter:
            maurizio.casimirri@mongodb.com Maurizio Casimirri
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: