Skip to content

[9.4-release] fix(google-maps): wait for shared context in interleaved mode (#10792) - #10852

Open
geoff-ux wants to merge 1 commit into
visgl:9.4-releasefrom
geoff-ux:backport/9.4-google-maps-interleaved-context
Open

geoff-ux wants to merge 1 commit into
visgl:9.4-releasefrom
geoff-ux:backport/9.4-google-maps-interleaved-context

Conversation

@geoff-ux

@geoff-ux geoff-ux commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #10792 to 9.4-release, as requested in that PR, so the fix can ship in a 9.4.x patch.

Closes #10704, #10059 and #10056 on the 9.4 line.

git cherry-pick -x d9e395c applied cleanly: modules/google-maps/src/google-maps-overlay.ts is identical on master and 9.4-release. No other changes.

Verified on this branch:

  • corepack yarn lint: passes
  • corepack yarn test-headless --reporter=verbose test/modules/google-maps: 21 passed

We now run 9.4.0 in production, so a 9.4 patch is the release we need. We no longer need the 9.3 backport requested in #10792.

🤖 Generated with Claude Code


Note

Medium Risk
Touches vector-map WebGL lifecycle and rendering paths where wrong context timing can break interleaved compositing; behavior is narrowed by new regression tests but still affects production map integration.

Overview
Fixes interleaved vector GoogleMapsOverlay so Deck is not created when the positioning OverlayView fires onAdd before Google’s shared WebGL context is ready.

_onAddVectorOverlay now receives the interleaved flag at callback bind time and skips createDeckInstance when interleaved, leaving Deck creation to _onContextRestored with the map’s gl context. _onDrawVector uses the same bound interleaved value instead of reading this.props on every draw.

Tests cover both overlay callback orderings, interleaved vs standalone contexts, and map-motion rendering (_drawLayers into the shared context vs redraw on a separate canvas), plus safer WebGL teardown in vitest.

Reviewed by Cursor Bugbot for commit 0c511bc. Bugbot is set up for automated code reviews on this repo. Configure here.

…10792)

* fix(google-maps): wait for shared context in interleaved mode

Co-authored-by: Codex <noreply@openai.com>

* fix(google-maps): keep context creation callbacks on the same mode

Bind the positioning callback to the mode already selected for the WebGL
callback. A setProps change before onAdd must not skip standalone Deck
creation or create an interleaved Deck without Google's context.

Add regression coverage for both mutations before callbacks run.

Co-authored-by: Codex <noreply@openai.com>

* fix(google-maps): draw with the original overlay mode

Keep onDraw on the mode selected for the context lifecycle callbacks. Updating interleaved while those callbacks are pending or after Deck initializes must not draw through the other context path.

Cover both callback orders and prop-change timings with creation and drawing assertions.

Co-authored-by: Codex <noreply@openai.com>

* test(google-maps): release Deck-owned WebGL contexts

Standalone Decks in the new tests each created a WebGL context that was
never released, so Chromium evicted the shared test device and later
suites failed to link shaders.

---------

Co-authored-by: Codex <noreply@openai.com>
Co-authored-by: Chris Gervang <chrisgervang@users.noreply.github.com>
Co-authored-by: Chris Gervang <chris.gervang@joby.aero>
(cherry picked from commit d9e395c)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T21:46:06.451656Z 0c511bc PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium impact] This backport appears safe to merge.

Summary

This backport makes interleaved Google Maps overlays wait for Google’s WebGL context before creating Deck.

  • Interleaved maps wait for Google’s context before Deck is created.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Attach vector overlay] --> B{Interleaved?}
  B -->|Yes| C[Positioning callback creates container only]
  B -->|Yes| D[Google supplies shared context]
  D --> E[Create Deck with shared context]
  B -->|No| F[Positioning callback creates Deck with its own canvas]
  E --> G[Google draw callback draws into shared canvas]
  F --> H[Google draw callback redraws separate canvas]
Loading

Reviews (1) · Last reviewed commit: "fix(google-maps): wait for shared contex..." · Reviewed by Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0c511bc484

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (!interleaved) {
// @ts-ignore (TS2345) map is defined at this stage
// Pass the positioning overlay for deck canvas creation (not WebGL overlay)
this._deck = createDeckInstance(this._map, overlay, this._deck, this.props);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Pass the bound mode into standalone Deck creation

When interleaved starts as false but setProps({interleaved: true}) runs before the positioning onAdd callback, this branch correctly stays on the standalone path, yet it passes the now-mutated this.props to createDeckInstance. In modules/google-maps/src/utils.ts:63, that true value suppresses the standalone canvas's pointerEvents: 'none' style, leaving the dedicated canvas pointer-active above Google Maps even though drawing remains non-interleaved; override the creation props with the callback's bound mode.

Useful? React with 👍 / 👎.

overlay.onAdd = noop;
overlay.onContextRestored = interleaved ? this._onContextRestored.bind(this) : noop;
overlay.onDraw = this._onDrawVector.bind(this);
overlay.onDraw = this._onDrawVector.bind(this, interleaved);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use the bound mode when detaching the overlay

When the overlay was bound with interleaved: true and that prop is later changed to false, this callback continues using shared rendering as intended, but setMap(null) at line 77 still checks mutable this.props.interleaved. It therefore skips the requestRedraw() used to repaint the Google canvas after removing an interleaved overlay, so the last deck frame can remain visible until an unrelated map repaint; retain and use the bound mode for teardown as well.

Useful? React with 👍 / 👎.

This branch has not been deployed

No deployments
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.

1 participant