[Bug]: the upsert method in base-shape.js may cause memory leak
Open
Nobody has claimed this yet.
performance
refactor
- Dominant language
- TypeScript
- Stars
- 12.3k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the bug / 问题描述
base-shape.ts中的upsert函数只关心新增或已存在的shape,如果渲染过程中shape的key值发生变化,已存在于 shapeMap 上的元素无法被清空
Reproduction link / 复现链接
No response
Steps to Reproduce the Bug or Issue / 重现步骤
render() {
upsert(`key-${Math.random()}`, ..., ...)
}
当每次渲染的shape的className不是相同的,上次渲染的shape就会常驻在shapeMap中,无法被删除和更新
Version / 版本
🆕 5.x
OS / 操作系统
- macOS
- Windows
- Linux
- Others / 其他
Browser / 浏览器
- Chrome
- Edge
- Firefox
- Safari (Limited support / 有限支持)
- IE (Nonsupport / 不支持)
- Others / 其他
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in base-shape.ts and trace the upsert function's handling of shapeMap entries during rendering. Reproduce the issue with a changing key such as key-${Math.random()}, then verify that shapes from earlier renders are removed or updated instead of remaining in shapeMap.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100