Visitar URL original
feat(core): asynchronous view resolution by Pessimistress · Pull Request #10865 · visgl/deck.gl · GitHub
Skip to content

feat(core): asynchronous view resolution - #10865

Merged
Pessimistress merged 4 commits into
masterfrom
codex/async-view-resolution
Oct 20, 2026
Merged

Pessimistress merged 4 commits into
masterfrom
codex/async-view-resolution

Conversation

@Pessimistress

@Pessimistress Pessimistress commented Oct 13, 2026 •

Copy link
Copy Markdown
Collaborator

For #10739

Preparation for introducing math.gl's projectionEngine

Change List

  • Add optional View.initialize that resolves asynchronously
  • LayerManager defers layer updates when context.viewport is unavailable
  • Unit tests

Note

Medium Risk
Changes core Deck initialization ordering and layer lifecycle timing; apps or tests that assumed an immediate default viewport may need to activate one explicitly.

Overview
Adds asynchronous view resolution so layers are not initialized or updated until a real viewport exists, paving the way for views that load projection resources before makeViewport() can succeed.

View API: optional initialize() (sync or async); makeViewport() may return null while initialization is pending. ViewManager starts initialization for new views, reuses prior view instances when props are equal (preserving in-flight init), exposes updateViewports() for deferred rebuilds, forwards init failures via onError (wired from Deck’s props.onError), and skips controllers when no viewport is available.

LayerManager: removes the synthetic default viewport; context.viewport is null until activateViewport runs. setLayers / updateLayers no-op until a viewport is set, queueing the latest layer list. When a viewport first becomes available, existing layers get viewportChanged / projectionChanged and a full update is scheduled.

Deck calls viewManager.updateViewports() each frame before layerManager.updateLayers(), refreshing the active viewport when async views finish.

Tests and harnesses now pass an explicit viewport into LayerManager, with new coverage for deferred layers and async/partial view failure.

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

@Pessimistress
Pessimistress requested a review from ibgreen October 13, 2026 20:57
@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new blocking issue was found.

Summary

Adds asynchronous view setup and waits for a viewport before running layer updates.

  • Views can finish setup before they provide a viewport.
  • Layer updates wait for a viewport before they begin.

No new actionable issues were found. Review was based on code inspection; tests were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[New view] --> B[Call initialize]
  B --> C{Viewport ready?}
  C -->|No| D[Defer layer updates]
  D --> E[Initialization finishes]
  E --> F[Mark viewports for update]
  F --> G[Deck rebuilds viewports]
  G --> H[Activate available viewport]
  C -->|Yes| H
  H --> I[Initialize or update layers]
Loading

Reviews (7) · Last reviewed commit: "address comments" · Reviewed by Greptile

Comment thread modules/core/src/lib/layer-manager.ts Resolved
Comment thread modules/core/src/lib/view-manager.ts Resolved
Comment thread modules/core/src/views/view.ts Resolved
@coveralls

coveralls commented Oct 13, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 83.728% (+0.03%) from 83.697% — codex/async-view-resolution into master

@Pessimistress
Pessimistress force-pushed the codex/async-view-resolution branch from b7a263e to 782689c Compare October 15, 2026 17:37

@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.

The async viewport lifecycle changes look good overall. I found one missed group of callers that should be updated before merge.

Comment thread modules/core/src/lib/layer-manager.ts Resolved
Comment thread modules/core/src/utils/crs.ts Resolved
@Pessimistress
Pessimistress force-pushed the codex/async-view-resolution branch from 6fee6dc to 782689c Compare October 20, 2026 18:21
@Pessimistress
Pessimistress force-pushed the codex/async-view-resolution branch from 782689c to ee509d6 Compare October 20, 2026 18:22

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ee509d6. Configure here.

Comment thread modules/core/src/lib/layer-manager.ts Resolved
@Pessimistress
Pessimistress merged commit 9952996 into master Oct 20, 2026
8 checks passed
@Pessimistress
Pessimistress deleted the codex/async-view-resolution branch October 20, 2026 21:53
@chrisgervang chrisgervang mentioned this pull request Oct 22, 2026
53 of 66 tasks
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.

3 participants