Skip to content

fix(jupyter-widget): size MapLibre map to the widget and load its CSS - #10951

Merged
chrisgervang merged 4 commits into
masterfrom
chr/fix-widget-maplibre-size
Oct 30, 2026
Merged

chrisgervang merged 4 commits into
masterfrom
chr/fix-widget-maplibre-size

Conversation

@chrisgervang

Copy link
Copy Markdown
Collaborator

Closes #10943

Background

The widget creates the MapLibre map before Jupyter attaches the view's element, so MapLibre falls back to 400x300. The element is attached before MapLibre's trackResize observer sends its first notification, which MapLibre skips, so the map is never resized.

Change List

  • createMapLibreDeckOverlay: resize the map once its container has a size
  • Load maplibre-gl.css for the maplibre provider
  • loadCSS: skip stylesheets that are already loaded
  • Unit tests

Verified in classic Notebook 6.5.7 with ipywidgets 7.8.5.

Before:
Before

After:
After

@coveralls

coveralls commented Oct 26, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 84.36% (+0.004%) from 84.356% — chr/fix-widget-maplibre-size into master

@chrisgervang chrisgervang added this to the v9.4 patch releases milestone Oct 26, 2026
@chrisgervang
chrisgervang marked this pull request as ready for review October 26, 2026 23:57
@greptile-apps

greptile-apps Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues remain.

Summary

Sizes detached MapLibre maps once their containers become visible and loads the matching stylesheet.

  • MapLibre maps resize when their widget containers get a usable size.
  • The playground loads MapLibre's CSS for MapLibre maps.

No new actionable issues were found. Tests were inspected but not run.

Reviews (4) · Last reviewed commit: "Merge branch 'master' into chr/fix-widge..." · Reviewed by Greptile

@chrisgervang chrisgervang mentioned this pull request Oct 29, 2026
29 of 30 tasks

@ibgreen ibgreen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with a non-blocking lifecycle follow-up. The one-time resize handles attachment after construction, and the version-matched MapLibre stylesheet plus stylesheet deduplication look appropriate. All reported CI checks pass at this commit; no local test rerun.

I agree with the existing observer cleanup concern: playground teardown calls deck.finalize(), while MapLibreOverlay.finalize() only removes the control, so it does not trigger the map's remove event. Closing a still-hidden widget before its container gains a size leaves this new observer connected. Please wire observer disconnection into widget finalization as a follow-up and cover finalization before sizing in a regression test. This is modest enough not to block the resize/CSS fix.

chrisgervang and others added 3 commits October 29, 2026 19:13
…idget closes

Widget teardown finalizes the overlay, which does not remove the map, so the
resize observer stayed connected for widgets closed before they had a size.
@chrisgervang
chrisgervang merged commit 3405ab5 into master Oct 30, 2026
9 checks passed
@chrisgervang
chrisgervang deleted the chr/fix-widget-maplibre-size branch October 30, 2026 07:41
chrisgervang added a commit that referenced this pull request Nov 3, 2026
@chrisgervang

Copy link
Copy Markdown
Collaborator Author

Released in deck.gl 9.4.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] jupyter-widget: MapLibre basemap renders at 400×300 and without its CSS

3 participants