ruilisi / fortune-sheet

A drop-in javascript spreadsheet library that provides rich features like Excel and Google Sheets
https://ruilisi.github.io/fortune-sheet-docs/
MIT License
2.54k stars 227 forks source link

Error When Using "=" in FortuneSheet Component #607

Closed Marcel-Kaminski closed 1 month ago

Marcel-Kaminski commented 1 month ago

Bug Report: Error When Using "=" in FortuneSheet Component

Description:
I am encountering an issue in a simple React project using the FortuneSheet component. When I enter the = character in any cell and then try to interact with another cell, an error occurs.

Steps to Reproduce:

  1. Create a basic React app.

  2. Implement a component using the FortuneSheet library as shown below:

    import React from 'react';
    import { Workbook } from 'fortunesheet';
    
    const FortuneSheetComponent = () => {
      const data = [
        {
          name: "Sheet1",
          celldata: [
            { r: 0, c: 0, v: { m: "A1", v: "A1" } },
            { r: 1, c: 1, v: { m: "B2", v: "B2" } }
          ]
        }
      ];
    
      return (
        <div style={{ width: "80vw", height: "60vh" }}>
          <Workbook
            data={data}
            onChange={(newData) => {
              console.log("Data changed:", newData);
            }}
          />
        </div>
      );
    };
    
    export default FortuneSheetComponent;
  3. Render the FortuneSheetComponent.

  4. Enter the character = in any cell.

  5. Click on any other cell.

Expected Behavior:
Entering = in a cell should not cause any errors, and the component should continue to function normally.

Actual Behavior:
After entering = in a cell and then clicking on another cell, an error occurs, interrupting the normal behavior of the sheet.

Screenshots/Links:
You can see the error message and stack trace in the following video:
Video

Additional Context:

Let me know if there's any additional information I can provide to help debug this issue.

sanchit3008 commented 1 month ago

hi marcel, thanks for reporting this. ill try to reproduce this and get back to you in case i need more info.

sanchit3008 commented 1 month ago

this was caused by some recent changes, i apologise for this. i am pushing the fix and will release it on monday when i have access to my machine. as a temp fix, you can use v0.19.14.

Marcel-Kaminski commented 1 month ago

Thanks, I will test it and let you know!