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

[Bug] Undefined cellValue lost during JSON conversion in sheet.mutation.move-range #4712

Closed
2 tasks done
nahooni0511 opened this issue Feb 24, 2025 · 1 comment
Closed
2 tasks done
Assignees
Labels
bug Something isn't working scope:sheet basics

Comments

@nahooni0511
Copy link

nahooni0511 commented Feb 24, 2025

Before you submit this issue, have you checked the following

  • Is this really a problem?
  • I have searched the Github Issues for similar issues, but did not find anything.

Affected packages and versions

0.6.1

Reproduction link

https://stackblitz.com/edit/univer-sheets-vite-ovsquyxg?file=src%2Fmain.ts

When executing the sheet.mutation.move-range mutation, if a cell's value is undefined, that information is lost during the JSON conversion process. This happens because JSON.stringify() automatically omits properties with undefined values.

Reproduction Steps:

const paramstr = JSON.stringify({
      fromRange: {
        startRow: 0,
        startColumn: 1,
        endRow: 0,
        endColumn: 1,
        rangeType: 0,
      },
      toRange: {
        startRow: 0,
        startColumn: 0,
        endRow: 0,
        endColumn: 0,
        rangeType: 0,
      },
      from: {
        value: {
          '1': {
            '1': null,
          },
        },
        subUnitId: workbook.getActiveSheet().getSheetId(),
      },
      to: {
        value: {
          '1': {
            '0': undefined,
          },
        },
        subUnitId: workbook.getActiveSheet().getSheetId(),
      },

      unitId: workbook.getId(),
      trigger: 'sheet.command.move-range',
    });
univerAPI.executeCommand('sheet.mutation.move-range', JSON.parse(paramstr));

Expected behavior

the cell at (0,0) is deleted.

Actual behavior

the cell at (0,0) is not deleted.

System information

No response

@univer-bot univer-bot bot added the bug Something isn't working label Feb 24, 2025
@hexf00
Copy link
Member

hexf00 commented Feb 24, 2025

This is the behavior of JS and has nothing to do with Univer

@jikkai jikkai closed this as completed Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working scope:sheet basics
Projects
None yet
Development

No branches or pull requests

4 participants