Repository navigation
Fix GeoJson on_each_feature callback crashing - #2358
Open
KhadeerBasha1232 wants to merge 1 commit into
Open
KhadeerBasha1232 wants to merge 1 commit into
KhadeerBasha1232 wants to merge 1 commit into
Conversation
The feature-propagation IIFE in the GeoJson template had no trailing semicolon, so the browser parsed it together with the following on_each_feature call and tried to call its return value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
KhadeerBasha1232
temporarily deployed
to
pypi
November 19, 2026 07:35 — with
GitHub Actions
Inactive
This branch was previously deployed
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.
Fix
GeoJson(on_each_feature=...)crashing since v1.0.0The problem
Every map that passes
on_each_featuretoGeoJsonfails in the browser:The GeoJson layer then shows no features at all. The example in the
on_each_feature user guide
is affected too: none of its markers are drawn.
The cause
#2263 (released in v1.0.0) added a small IIFE at the start of the generated
onEachFeaturefunction, which copiesfeatureto the child layers ofmulti-geometries. That statement has no trailing semicolon:
A line that starts with
(doesn't trigger automatic semicolon insertion, sothe browser reads this as one expression. It calls the IIFE's return value
(
undefined) with the user's callback as its argument, which throws.The fix
Add the missing semicolons to the IIFE in the template. No behaviour changes
apart from that: the propagation from #2263 still runs first, then the
user's callback.
Tests
New Selenium test
test_geojson_on_each_feature. It adds a GeoJson with anon_each_featurecallback that binds a permanent tooltip, then checks thatthe console has no errors and the tooltip is shown.
Checked in a browser, before and after the fix:
on_each_featuretooltip (the new test case)on_each_featureuser guidetests/test_features.pyandtests/test_issue_2278.pystill pass.