[Bug]: IF formula error
Description
Description
In Vue3 by setCellContents set=IF(Sheet2!B1>1, “true”, “false”) the following exception is reported Uncaught TypeError: Cannot read properties of undefined (reading ' licenseKeyValidityState') But under Nodejs it works fine
Video or screenshots
Demo
https://stackblitz.com/edit/vitejs-vite-e4bvdm7a?file=src%2FApp.vue
HyperFormula version
v3.0.0
Your framework
Vue3
Your environment
windows edge
Thank you for sharing the issue result. I was able to replicable the error response, and while we keep executing the same method over and over, we get an additional error
vue.js?v=95fbf505:2334 Uncaught Error: Value of the formula cell is not computed.
at Proxy.getCellValue (hyperformula.js?v=49c994f8:11765:13)
at Proxy.getCellValue (hyperformula.js?v=49c994f8:11210:21)
at Proxy.getScalarValue (hyperformula.js?v=49c994f8:13314:39)
at Proxy.getCellValue (hyperformula.js?v=49c994f8:21747:59)
at hyperformula.js?v=49c994f8:21753:57
at Proxy.genericSheetGetter (hyperformula.js?v=49c994f8:21766:21)
at Proxy.getSheetValues (hyperformula.js?v=49c994f8:21753:17)
at hyperformula.js?v=49c994f8:21797:54
at Proxy.genericAllSheetsGetter (hyperformula.js?v=49c994f8:21789:27)
at Proxy.getAllSheetsValues (hyperformula.js?v=49c994f8:21797:17)
I haven't been able to identify the reason behind it yet, but as the syntax is correct, I believe we can call it a bug. I will update the thread with any new findings.
I think I found the problem, using ref in Vue3 turns it into a responsive object. This operation may affect the original object, the correct operation is to not use or use reactive, if you must use ref you can use toRaw wrapping, this error may not only occur in setting formulas. Maybe you guys can mark the docs This is the demo link https://stackblitz.com/edit/vitejs-vite-mwacnqr2?file=src%2FApp.vue
Thank you for additional research.
I think it's worth mentioning on our Integration with Vue site.
In more complex cases, like using HyperFormula together with Handsontable, it also may be helpful to prevent Vue from injecting the reactive proxy by marking the HyperFormula instance as raw:
const hfInstance = markRaw(
HyperFormula.buildEmpty({
licenseKey: 'internal-use-in-handsontable',
})
);
Hi @luotaox
I am happy to share the good news. We just launched HyperFormula v3.1.0 and we updated our Integration with Vue guide to describe this issue.
Here, you can read more about the changes in this version.