dream-num / univer

Univer is an open-source alternative to Google Sheets, Slides, and Docs

Home Page:https://univer.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] range api setValue

chenyuan4x7 opened this issue · comments

在您提交此问题之前,您是否检查了以下内容?

  • 这真的是个问题吗?
  • 我已经在 Github Issues 中搜索过了,但没有找到类似的问题。

受影响的包和版本

0.1.13

复现链接

univerAPI.value = FUniver.newAPI(univer); /*const range = { startRow: 1, startColumn: 1, endRow: 1, endColumn: 1, }; univerAPI.value.executeCommand('sheet.command.set-range-values', { value: 'Test Univer', range });*/ const activeWorkbook = univerAPI.value.getActiveWorkbook(); const activeSheet = activeWorkbook.getActiveSheet(); const range = activeSheet.getRange(0, 0, 2, 2); range.setValue('Test Univer');
https://sheetsvitedemo-s2r2--5173--12d46890.local-credentialless.webcontainer.io

预期行为

setValue the console has no error message [Cannot destructure property 'skeleton' of 'n.getCurrent(...)' as it is undefined.]
setValue 可以正常赋值, 控制台无报错提示 [Cannot destructure property 'skeleton' of 'n.getCurrent(...)' as it is undefined.]

实际行为

setValue the console prompts an error; [Cannot destructure property 'skeleton' of 'n.getCurrent(...)' as it is undefined.]
setValue 可以正常赋值, 控制台提示报错; [Cannot destructure property 'skeleton' of 'n.getCurrent(...)' as it is undefined.]``
5d4a09679c62504573bcf65da35d3b8

运行环境

Chrome

系统信息

No response

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

Origin Title: [Bug] range api setValue

Title: [Bug] range api setValue


Before you submitted this question, did you check the following?

  • Is this really a problem?
  • I've searched Github Issues but haven't found any similar issues.

Affected packages and versions

0.1.13

Recurrence link

univerAPI.value = FUniver.newAPI(univer); /*const range = { startRow: 1, startColumn: 1, endRow: 1, endColumn: 1, }; univerAPI.value.executeCommand('sheet.command.set-range-values', { value: 'Test Univer', range });*/ const activeWorkbook = univerAPI.value.getActiveWorkbook(); const activeSheet = activeWorkbook.getActiveSheet(); const range = activeSheet.getRange(0, 0, 2, 2); range.setValue('Test Univer');
https://sheetsvitedemo-s2r2--5173--12d46890.local-credentialless.webcontainer.io

Expected behavior

setValue the console has no error message [Cannot destructure property 'skeleton' of 'n.getCurrent(...)' as it is undefined.]
setValue can be assigned normally, and there is no error message on the console [Cannot destructure property 'skeleton' of 'n.getCurrent(...)' as it is undefined.]

Actual behavior

setValue the console prompts an error; [Cannot destructure property 'skeleton' of 'n.getCurrent(...)' as it is undefined.]
setValue can be assigned normally, but the console prompts an error; [Cannot destructure property 'skeleton' of 'n.getCurrent(...)' as it is undefined.]``
5d4a09679c62504573bcf65da35d3b8

Running environment

Chrome

system message

No response

Please provide a valid link.

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

Please provide a valid link.

https://stackblitz.com/edit/github-i8z5an?file=src%2Fcomponents%2FUniverSheet.vue

@chenyuan-tanzhuang I found that calling setValue within setTimeout does not trigger an error message. If this helps you, I will further investigate the issue.

@chenyuan-tanzhuang 我发现setValue在内部调用setTimeout不会触发错误消息。如果这对您有帮助,我会进一步调查该问题。
setTimeout usable, but each used once setValue needs to be wrapped setTimeout?
setTimeout是可以的, 但是每个地方使用 setValue 都需要 setTimeout进行包裹吗

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿

@chenyuan-tanzhuang I found that setValue internally calls setTimeout without triggering an error message. If this helps you, I'll look into the issue further.
setTimeout usable, but each used once setValue needs to be wrapped setTimeout?
setTimeout is possible, but does it need to be wrapped with setTimeout every time setValue is used?

setTimeout usable, but each used once setValue needs to be wrapped setTimeout?

Immediately calling setValue after instance creation requires wrapping it in setTimeout(() => {}, 0). This is just a temporary measure, and I am investigating the cause. After the instance is created, if it is an asynchronous operation (such as responding to a user click event), there is no need to add setTimeout.

setTimeout usable, but each used once setValue needs to be wrapped setTimeout?

Immediately calling setValue after instance creation requires wrapping it in setTimeout(() => {}, 0). This is just a temporary measure, and I am investigating the cause. After the instance is created, if it is an asynchronous operation (such as responding to a user click event), there is no need to add setTimeout.

thank you !