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

Why my updateSheet method not works? #611

Open
khj0426 opened this issue Oct 10, 2024 · 0 comments
Open

Why my updateSheet method not works? #611

khj0426 opened this issue Oct 10, 2024 · 0 comments

Comments

@khj0426
Copy link

khj0426 commented Oct 10, 2024

Describe the bug
A clear and concise description of what the bug is.

TypeError: Cannot assign to read only property 'data' of object '#'

I get this errror when i use update sheet method.
i tried to use immer to maintain object deep, but i got a same error.

why my error begin and how cam i resolve it?

<Workbook
  data={scheduleData?.data as any}
  ref={ref}
  onChange={(data) => {
    if (ref.current) {
      const updatedData = produce(
        scheduleData.data,
        (draft) => {
          data.forEach((newSheet, index) => {
            draft[index] = {
              ...draft[index], // 기존 데이터 유지
              ...newSheet, // 새로운 데이터로 업데이트
            };
          });
        }
      );

      ref.current.updateSheet(updatedData); // 업데이트 호출
    }
  }}
  lang={lng}
  config={{
    cellTextOverflow: "visible",
    cellAutoWrap: true,
    readOnly: true,
  }}
/>

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@khj0426 and others