hyperformula icon indicating copy to clipboard operation
hyperformula copied to clipboard

Vertex for address missing in AddressMapping when adding a row/col & then clearing the sheet

Open MartinDawson opened this issue 4 years ago • 2 comments

Browser: Chrome OS: Ubuntu 12.x HF version: 1.3.0

Example with the error: https://codesandbox.io/s/gallant-jepsen-ix935?file=/src/index.js

Apologies for the large data set. I tried to figure out what is wrong but was unable to.

The bug only happens with chooseAddressMappingPolicy: new AlwaysSparse(). However I cannot change this in our code because we rely on AlwaysSparse (at least for now...)

If you change the addRows line to this -> hf.addRows(0, [8, 1]) then hyperformula is NOT throwing any errors. So it's only before row 8 it throws.

Reproducible error code (probably depends on the data in tableData):

import HyperFormula, { AlwaysSparse } from "hyperformula";
import { tableData } from "./data";

// Create an empty HyperFormula instance.
const hf = HyperFormula.buildFromSheets(tableData, {
  licenseKey: "gpl-v3",
  chooseAddressMappingPolicy: new AlwaysSparse()
});

hf.addRows(0, [0, 1]);

const sheetName = hf.getSheetName(0);

const sheetId = hf.getSheetId(sheetName);

hf.clearSheet(sheetId);

In my real code this bug happens after I add a row and undo on the spreadsheet.

We clear the current sheet and then set the hyperformula values again which results in the above error.

MartinDawson avatar Nov 06 '21 15:11 MartinDawson

I am sorry you experienced an issue with HyperFormula. Our team will investigate it.

sequba avatar Apr 26 '22 11:04 sequba

~~As part of this issue, please cross link from the API reference https://handsontable.github.io/hyperformula/api/interfaces/configparams.html#chooseaddressmappingpolicy to the Guide https://handsontable.github.io/hyperformula/guide/performance.html#address-mapping-strategies, because the API reference does not explain the point of using the configuration option chooseAddressMappingPolicy.~~

(moved to #947)

warpech avatar Jun 24 '22 09:06 warpech

Increasing impact since we received another similar bug report:

Note: Using default chooseAddressMappingPolicy

Error: Vertex for address missing in AddressMapping
    at AddressMapping.fetchCell (AddressMapping.js?cb8a:36:1)
    at eval (DependencyGraph.js?3bb8:73:1)
    at Array.map (<anonymous>)
    at DependencyGraph.dependencyQueryVertices [as dependencyQuery] (DependencyGraph.js?3bb8:66:1)
    at Graph.removeDependencies (Graph.js?9e87:334:1)
    at Graph.removeNode (Graph.js?9e87:148:1)
    at DependencyGraph.removeVertexAndCleanupDependencies (DependencyGraph.js?3bb8:1176:1)
    at DependencyGraph.removeVertex (DependencyGraph.js?3bb8:1157:1)
    at DependencyGraph.removeSheet (DependencyGraph.js?3bb8:384:1)
    at Operations.removeSheet (Operations.js?0eba:153:1)

Details in the internal discussion: https://handsoncode.slack.com/archives/C031GBX62SE/p1666592446192099

sequba avatar Oct 25 '22 10:10 sequba

Closing. We do not have enough information to address this issue. @MartinDawson please re-open it when you are able to provide a demo that reproduces the bug.

sequba avatar Nov 10 '22 14:11 sequba