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

[Bug]: In a specific combination of adding rows, content, and column amount alteration we get Uncaught Error from the DenseStrategy #1406

Open
AMBudnik opened this issue Apr 12, 2024 · 3 comments
Labels
Bug Something isn't working Impact: High

Comments

@AMBudnik
Copy link
Contributor

AMBudnik commented Apr 12, 2024

Description

In a specific combination of adding rows, content, and column amount alteration we get Uncaught Error from the DenseStrategy.

Case 1

  • add an empty row below the last one (call addRows() on last index)
  • again, add an empty row below the last one (call addRows() on last index)
  • add a value in the last row (call setCellContents() on the index of the lastly added row)
  • add a new column (call addColumns() on any index)

Case 2

  • add an empty row below the last one (call addRows() on last index)
  • again, add an empty row below the last one (call addRows() on last index)
  • add a value in the last row (call setCellContents() on the index of the lastly added row)
  • remove any column (call removeColumns () on any index),

Video or screenshots

Error for column addition

Uncaught TypeError: Cannot read properties of undefined (reading 'splice')
    at DenseStrategy.addColumns (hyperformula.js?v=bfc9e82e:14088:23)
    at AddressMapping.addColumns (hyperformula.js?v=bfc9e82e:11312:18)
    at hyperformula.js?v=bfc9e82e:13184:27
    at EmptyStatistics.measure (hyperformula.js?v=bfc9e82e:10956:20)
    at _DependencyGraph.addColumns (hyperformula.js?v=bfc9e82e:13183:16)
    at Operations.doAddColumns (hyperformula.js?v=bfc9e82e:18737:30)
    at Operations.addColumns (hyperformula.js?v=bfc9e82e:18183:12)
    at CrudOperations.addColumns (hyperformula.js?v=bfc9e82e:19594:21)
    at _HyperFormula.addColumns (hyperformula.js?v=bfc9e82e:23494:26)
    at main.js:45:4

Error for column removal

Uncaught TypeError: Cannot read properties of undefined (reading 'splice')
    at DenseStrategy.removeColumns (hyperformula.js?v=dabf68a5:14100:23)
    at AddressMapping.removeColumns (hyperformula.js?v=dabf68a5:11319:18)
    at hyperformula.js?v=dabf68a5:13147:27
    at EmptyStatistics.measure (hyperformula.js?v=dabf68a5:10956:20)
    at _DependencyGraph.removeColumns (hyperformula.js?v=dabf68a5:13146:16)
    at Operations.doRemoveColumns (hyperformula.js?v=dabf68a5:18678:30)
    at Operations.removeColumns (hyperformula.js?v=dabf68a5:18189:35)
    at CrudOperations.removeColumns (hyperformula.js?v=dabf68a5:19602:45)
    at _HyperFormula.removeColumns (hyperformula.js?v=dabf68a5:23567:26)
    at main.js:45:4

Demo

{column addition} https://stackblitz.com/edit/vitejs-vite-w55sez?file=index.html,main.js&terminal=dev ; {column removal} https://stackblitz.com/edit/vitejs-vite-1ssmt8?file=index.html,main.js&terminal=dev

HyperFormula version

2.7.0

Your framework

Vanilla JS

Your environment

Chrome 123, macOS Ventura

@AMBudnik AMBudnik added the Bug Something isn't working label Apr 12, 2024
@sequba
Copy link
Contributor

sequba commented Apr 16, 2024

Once it's fixed in the HperFormula, we should verify if the analogous scenario is working correctly in Handsontable

@richcanvas
Copy link

i also have this error as the following simple case:
let data=[
[],
[,1],
[,2],
[,'=sum(B2:B3)']
]
const options = {licenseKey: 'gpl-v3',}
let hf=HyperFormula.buildEmpty(options)
hf.addSheet('sheet1')
hf.setSheetContent(0,data)
let can=hf.isItPossibleToRemoveColumns(0,[0,1])
console.log(can)
let changes=hf.removeColumns(0,[0,1]) //throw exception

it's ok to call HyperFormula.buildFromSheets(xxx)

@AMBudnik
Copy link
Contributor Author

Thank you for sharing the scenario, @richcanvas we will test it as well and update you upon fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Impact: High
Projects
None yet
Development

No branches or pull requests

3 participants