ProfessionalWiki / ProfessionalWiki/Maps
LeafletEditor.remove() crashes if no edits were made
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 78
- Forks
- 65
- Avg merge
- 9h 17m
- Merged PRs (30d)
- 6
Description
Issue
`LeafletEditor.remove()` calls `self.saveButton.remove()` unconditionally, but `self.saveButton` is only created when `_showSaveButton()` is called (i.e., after the user creates, edits, or deletes a feature). If `remove()` is called before any edits were made, it crashes with `TypeError: Cannot read properties of undefined (reading 'remove')`.
Steps to reproduce
- Initialize the LeafletEditor on a GeoJSON page
- Call `editor.remove()` without making any edits
Expected behavior
`remove()` should clean up gracefully regardless of whether edits were made.
Actual behavior
`TypeError: Cannot read properties of undefined (reading 'remove')` — the draw controls and GeoJSON layer are never cleaned up because the error occurs before `self.geoJsonLayer.remove()`.
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 at LeafletEditor.remove() and compare its cleanup sequence with _showSaveButton(), which creates saveButton. Reproduce by initializing the editor and calling remove() before any edits; done means removal completes without a TypeError and the draw controls and GeoJSON layer are cleaned up.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100