[Bug]: Browser freezes when parsing a long numeric-like string
Description
Bug description
When using the HyperFormula basic usage demo, replacing the default tableData with a specific long numeric-like string causes the browser to freeze.
This happens immediately upon loading the sheet, before any interaction.
Characteristics of problematic strings
The issue tends to occur when the input string:
- Is long (typically 40+ characters)
- Starts with digits
- Includes a non-numeric character such as
'a','-', or a space' ' - The non-numeric character appears toward the end
✅ Example (causes freeze):
123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 123
✅ Example (does not freeze):
123.456
123456a
123 456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123
Reproduction steps
Use the following change in the Basic Usage demo:
// default (no issue)
const tableData = [['10', '20', '=SUM(A1,B1)']];
// replace with (causes freeze)
const tableData = [['123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 123', '20', '=SUM(A1,B1)']];
Just rendering this table will freeze the browser.
Context
- I am developing a web-based application that integrates HyperFormula via the Handsontable plugin
- In the demo, strings around 90 characters cause the issue
- In production, it can occur with inputs as short as 40–50 characters, depending on the browser or device
- In the application I’m building, users occasionally paste values that fit this pattern — so this kind of input occurs sporadically in real usage
- Although the value is just a string, its numeric-like format seems to trigger costly processing, leading to performance issues
- As a temporary workaround, I insert invisible special characters such as U+2060 (Word Joiner) or U+200C (Zero Width Non-Joiner) at the start of strings exceeding a certain length
Suggested improvement
Consider adding a configuration option (e.g., maxNumericInputLength) or introducing internal safeguards to prevent unnecessary numeric parsing of long, ambiguous strings.
Video or screenshots
No response
Demo
https://stackblitz.com/edit/ehyvawef?file=index.ts
HyperFormula version
3.0.0
Your framework
React 18
Your environment
Chrome 138, Edge 138, Firefox 140
@Porinn does it happen in your standalone app or only in the Stackblitz demo? Do you use any frontend framework?
@sequba
Reproduction Environment
- Occurs in my standalone app (a Vite-bundled React application), not just in the StackBlitz demo.
Framework & Key Libraries
- Framework: React 18.1.0
- Bundler: Vite 6.0.3
- Handsontable Integration: @handsontable/react 15.3.0 with hyperformula 3.0.0
- UI Component Library: Mantine 7.17.2
Simplified demo: https://stackblitz.com/edit/ehyvawef-jx4uztmx?file=index.ts
The way our parser treats such strings seems to be highly inefficient. I'm adding this bug to our backlog.