Skip to content

Fix/add row column plugin release error#5141

Open
wkeylin wants to merge 2 commits into
VisActor:developfrom
wkeylin:fix/add-row-column-plugin-release-error
Open

Fix/add row column plugin release error#5141
wkeylin wants to merge 2 commits into
VisActor:developfrom
wkeylin:fix/add-row-column-plugin-release-error

Conversation

@wkeylin
Copy link
Copy Markdown

@wkeylin wkeylin commented May 17, 2026

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Refactoring
  • Update dependency
  • Code style optimization
  • Test Case
  • Branch merge
  • Site / documentation update
  • Demo update
  • Workflow
  • Chore
  • Release
  • Other (about what?)

🔗 Related issue link

fixed #5140

💡 Background and solution

AddRowColumnPlugin 的 release() 方法中直接调用了 this.leftDotForAddColumn.remove() 等 8 个 UI 元素的 remove() 方法。但这些 UI 元素(如 leftDotForAddColumn、rightDotForAddColumn、addIconForAddColumn 等)是在用户交互过程中懒创建的,如果插件在这些元素被创建之前就调用了 release()(例如初始化后直接销毁表格),这些属性为 undefined,导致抛出 Cannot read properties of undefined (reading 'remove') 错误。

在 release() 方法中对所有 UI 元素的 remove() 调用添加可选链操作符 ?.,确保元素未初始化时安全跳过,不会抛出异常

📝 Changelog

Language Changelog
🇺🇸 English fix: add optional chaining in AddRowColumnPlugin release to prevent errors
🇨🇳 Chinese 修复:AddRowColumnPlugin 的 release() 方法在 UI 元素未初始化时抛出空引用错误

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

copilot:summary

🔍 Walkthrough

copilot:walkthrough

@github-actions github-actions Bot added the chore label May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] AddRowColumnPlugin 的 release() 方法在 UI 元素未初始化时抛出空引用错误

1 participant