Skip to content

fix(ngx-dashboard): restore shared state for lazy-registered widget types#6

Merged
TobyBackstrom merged 2 commits into
mainfrom
fix/shared-state-late-registration
Apr 19, 2026
Merged

fix(ngx-dashboard): restore shared state for lazy-registered widget types#6
TobyBackstrom merged 2 commits into
mainfrom
fix/shared-state-late-registration

Conversation

@TobyBackstrom
Copy link
Copy Markdown
Owner

Summary

  • Fixes a bug where WidgetSharedStateProvider state was silently dropped when loadDashboard() ran before the
    widget type was registered (lazy-loaded modules).
  • Makes shared-state restoration symmetric with the existing factory self-healing: restoreSharedStates() now buffers
    unmatched entries, and registerWidgetType() drains the buffer when a matching provider registers later.
  • Adds 3 new service-level tests covering the before/after/overwrite scenarios.

Test plan

  • ng test ngx-dashboard --no-watch --browsers=ChromeHeadless — 476/476 pass (was 473)
  • ng lint ngx-dashboard — clean
  • CI matrix (Node 18.x / 20.x)

TobyBackstrom and others added 2 commits April 19, 2026 12:12
…ypes

When loadDashboard() runs before a widget type with a shared-state provider
is registered (e.g. lazy-loaded modules), the restored state was silently
dropped because no provider existed at restore time. Factory self-healing
already handled the analogous case for widget factories; this makes shared
state symmetric: restoreSharedStates() now buffers unmatched entries, and
registerWidgetType() drains the buffer when a matching provider arrives.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@TobyBackstrom TobyBackstrom force-pushed the fix/shared-state-late-registration branch from c73adca to b87a2aa Compare April 19, 2026 10:15
@TobyBackstrom TobyBackstrom merged commit d4eb629 into main Apr 19, 2026
1 check passed
@TobyBackstrom TobyBackstrom deleted the fix/shared-state-late-registration branch April 19, 2026 10:17
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