Skip to content

fix(core): disable a controller with no view state instead of throwing - #10731

Merged
chrisgervang merged 5 commits into
masterfrom
claude/view-manager-default-view-controller
Sep 29, 2026
Merged

chrisgervang merged 5 commits into
masterfrom
claude/view-manager-default-view-controller

Conversation

@chrisgervang

@chrisgervang chrisgervang commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #10730

Background

A Deck created with a top-level controller, a per-view initialViewState and no views (a widget such as SplitterWidget provides them a frame later) starts with the default view. Its controller resolves to the keyed view state map, so MapState asserts, and the exception escapes ViewManager._update() before _isUpdating is reset, so the manager never rebuilds again and the widget's views never get controllers.

Change List

  • ViewManager: skip the controller of a view whose view state cannot be resolved; a view that owns its viewState prop or has an entry in the keyed map keeps its controller, and the controller is created on a later rebuild once views or viewState change
  • ViewManager._update: reset _isUpdating in a finally so one failing rebuild cannot wedge later updates
  • Unit tests

Verified with yarn lint, yarn vitest run --project headless test/modules/core (397 passed), and a headless Chromium run of the pydeck SplitterWidget example against a bundle built from this branch: both panes get controllers, no assertion, no console warnings.

This description was drafted by an AI coding agent following the guidelines proposed in #10707.


Note

Medium Risk
Touches core view/controller lifecycle during rebuild; behavior change is intentional for missing view state but affects when controllers attach.

Overview
Fixes a startup path where a default view with controller: true meets a keyed viewState map (no entry for that view), which used to assert inside MapState and could leave ViewManager stuck because _isUpdating never cleared.

ViewManager now skips attaching a controller when _hasViewState(view) is false (view-owned viewState, a keyed entry, or a single global state still work); viewports still build and controllers appear on later setProps when state or views arrive. _update() resets _isUpdating in a finally block so one failed rebuild cannot block future updates.

Adds unit coverage for late view state, multi-view keyed maps, and views that own their viewState.

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

A Deck created with a top-level controller, a per-view initialViewState and no
views (a widget such as SplitterWidget provides them later) starts with the
default view, whose controller resolved to the keyed view state map and made
MapState assert. The assertion escaped ViewManager._update() before
_isUpdating was reset, so the manager never rebuilt again and the widget's
views never received controllers.

ViewManager now skips (and warns about) a controller whose view cannot resolve
a view state, and _update() always resets _isUpdating.

Closes #10730

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GoghM5SYvzaConbutwAw21

Copy link
Copy Markdown
Collaborator Author

@greptileai review

bugbot run


Generated by Claude Code

@greptile-apps

greptile-apps Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Changes how view controllers initialize when view state is missing.

The PR appears safe to merge based on this review.

Summary

This PR skips controller creation when a view has no resolvable view state, allows the controller to attach on a later rebuild, and resets the update guard after a failed rebuild.

  • Adds tests for late view-state arrival and view-owned state.
  • No new actionable issues were identified since the previous review.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Rebuild viewports] --> B{View requests controller?}
  B -- No --> E[No controller]
  B -- Yes --> C{View state resolvable?}
  C -- No --> E
  C -- Yes --> D[Create or update controller]
  E --> F[Build viewport]
  D --> F
Loading

Reviews (6) · Last reviewed commit: "Merge branch 'master' into claude/view-m..."

Comment thread modules/core/src/lib/view-manager.ts Resolved
A view whose viewState prop fully defines its state never reads the
manager-level view state, so the no-view-state check must not disable its
controller when the manager state is a keyed map without that view's id.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GoghM5SYvzaConbutwAw21
@coveralls

coveralls commented Sep 22, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 82.472% (+0.02%) from 82.451% — claude/view-manager-default-view-controller into master

Copy link
Copy Markdown
Collaborator Author

@greptileai review

bugbot run


Generated by Claude Code

The skipped controller is an expected transient state when a widget provides
views after construction. The explanation lives in a code comment; a test
covers the controller being created once the view state arrives.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GoghM5SYvzaConbutwAw21

Copy link
Copy Markdown
Collaborator Author

@greptileai review

bugbot run


Generated by Claude Code

@chrisgervang
chrisgervang marked this pull request as ready for review September 22, 2026 14:52
@chrisgervang
chrisgervang merged commit d5c7695 into master Sep 29, 2026
8 checks passed
@chrisgervang
chrisgervang deleted the claude/view-manager-default-view-controller branch September 29, 2026 14:53
@chrisgervang chrisgervang added this to the v9.4 patch releases milestone Oct 4, 2026
This was referenced Oct 7, 2026
chrisgervang added a commit that referenced this pull request Oct 22, 2026
@chrisgervang

Copy link
Copy Markdown
Collaborator Author

Released in deck.gl 9.4.1.

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] Top-level controller with per-view initialViewState and widget-managed views throws and wedges ViewManager

4 participants