-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
Severity
P2 — Memory leak / stale state
Description
In `src/teritorio-cluster.ts:123-133`, `onRemove` removes markers and event listeners but does not reset internal state:
- `this.markersOnScreen` — still populated after removal
- `this.clusterLeaves` — retains stale cluster data
- `this.featuresMap` — retains stale feature data
- `this.selectedFeatureId` — still references a feature
- `this.map` — still references the map instance
- `this.source` — still references the source
If the instance is held by consumer code after layer removal, these references prevent garbage collection of the map, source, and all DOM elements referenced by features.
Suggested Fix
Add state cleanup at the end of `onRemove`:
```ts
this.markersOnScreen.clear()
this.clusterLeaves.clear()
this.featuresMap.clear()
this.selectedFeatureId = null
this.map = null
this.source = null
```
Files
- `src/teritorio-cluster.ts:123-133`
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working