Fix LeafletEditor.remove() crash when no edits were made#889
Draft
JeroenDeDauw wants to merge 1 commit intomasterfrom
Draft
Fix LeafletEditor.remove() crash when no edits were made#889JeroenDeDauw wants to merge 1 commit intomasterfrom
JeroenDeDauw wants to merge 1 commit intomasterfrom
Conversation
self.saveButton is only created after the user makes a change (via _showSaveButton). Calling remove() before any edits crashes with TypeError because self.saveButton is undefined, which also prevents geoJsonLayer cleanup from running. Add null guard and QUnit tests that verify actual layer cleanup (layerCount decreases), which also serves as mutation verification: without the fix, the TypeError prevents geoJsonLayer.remove() from executing, so layer count stays the same and the test fails. Closes #888 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1f0d688 to
388cf15
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LeafletEditor.remove()callsself.saveButton.remove()unconditionally, butsaveButtonis only created after the user makes an editremove()before any edits crashes withTypeError, preventing cleanup of draw controls and GeoJSON layerif (self.saveButton)before calling.remove()Closes #888
Test plan
remove()without edits completes without errorremove()after edits completes without error🤖 Generated with Claude Code