Skip to content

[Bug]: Browser freezes when parsing a long numeric-like string #1520

@Porinn

Description

@Porinn

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

Metadata

Metadata

Assignees

Labels

BugSomething isn't workingImpact: MediumPerformanceIssues related to the performance

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions