🐛 [BUG] 图层切换显示组件有问题
- Dominant language
- TypeScript
- Stars
- 87
- Forks
- 34
- PR merge metrics
- No merged PRs in 30d
Description
我增加了两个图层 控制台报错信息

```
Warning: Cannot update a component (`LayerSwitchControl2`) while rendering a different component (`ForwardRef(BubbleLayer3)`). To locate the bad setState() call inside `ForwardRef(BubbleLayer3)`, follow the stack trace as described in https://reactjs.org/link/setstate-in-render
BubbleLayer3@http://127.0.0.1:5173/node_modules/.vite/deps/@antv_larkmap.js?v=505fd349:28947:32
AreaMarkLayer@http://127.0.0.1:5173/src/map-features/AreaMarkLayer.tsx:23:39
div
LarkMap2@http://127.0.0.1:5173/node_modules/.vite/deps/@antv_larkmap.js?v=505fd349:23306:12
GaoDeMapInstance@http://127.0.0.1:5173/src/GaoDeMapInstance.tsx?t=1695886767663:48:39
App@http://127.0.0.1:5173/src/App.tsx?t=1695886189350:23:37 react-dom.development.js:86:29
React 5
onUpdateLayerList2 index.js:18
doEmit index.ts:69
emit index.ts:73
addLayer layer-manager.js:66
useCreateLayer2 index.js:45
BubbleLayer3 index.js:10
React 8
workLoop scheduler.development.js:266
flushWork scheduler.development.js:239
performWorkUntilDeadline scheduler.development.js:533
(异步:EventHandlerNonNull)
js scheduler.development.js:571
js scheduler.development.js:633
__require chunk-ROME4SDB.js:11
js index.js:6
__require chunk-ROME4SDB.js:11
React 2
__require chunk-ROME4SDB.js:11
js React
__require chunk-ROME4SDB.js:11
js React
__require chunk-ROME4SDB.js:11
react-dom_client.js:38
```
## 右上角只能显示一个图层,不能切换双图层

- **LarkMap Version**: 最新版
- **Platform**: react 18
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the issue by adding two layers in the React 18 example, then read AreaMarkLayer.tsx and GaoDeMapInstance.tsx alongside the LayerSwitchControl2/BubbleLayer3 stack trace. Trace onUpdateLayerList2 and the layer-manager addLayer path to determine why switching layers updates during rendering. Done means both layers appear in the upper-right control, can be switched, and the warning no longer occurs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- data-visualization, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100