Skip to content

fix(frontend): Open variation editor modal via route registration#149

Merged
mattbrailsford merged 1 commit into
devfrom
feature/fix-variation-modal-route-context
May 5, 2026
Merged

fix(frontend): Open variation editor modal via route registration#149
mattbrailsford merged 1 commit into
devfrom
feature/fix-variation-modal-route-context

Conversation

@mattbrailsford
Copy link
Copy Markdown
Contributor

Summary

Closes #144. Selecting a document type in the Entity Context picker on a test variation silently did nothing.

The variation config editor modal was opened via modalManager.open(), so <umb-modal> mounted an UmbContextBoundary over UMB_ROUTE_CONTEXT instead of a real <umb-router-slot>. Inside the modal, uai-mock-entity (added in #125) could no longer consume UMB_ROUTE_CONTEXT, its UmbModalRouteRegistrationController never fired, and #editorRoutePath never resolved — so the sub-type click pushed nothing.

This switches the variation builder to UmbModalRouteRegistrationController + history.pushState, mirroring uai-mock-entity's own pattern. The modal now carries a router, publishes UMB_ROUTE_CONTEXT to its content, and the chain that #125 needs for nested block-grid editors stays intact.

UaiTestVariationConfigEditorModalValue gets | undefined added for the same reason UaiMockEntityEditorModalValue does — UmbModalRouteSetupReturn's typing only makes value optional when the token's value type is ... | undefined.

Test plan

  • Test → variation → Entity Context → +Add → Document → Article — the mock entity editor should now open
  • Inside the entity context editor, exercise a doc-type with block grid / block list / block rte properties — "Create new" should still open the catalogue modal (not silently insert), and block edit links should still work (regression check for Route-register mock entity editor modal for block grid support #125)
  • Add a new variation, edit an existing variation, cancel via Escape, cancel via the Cancel button — variations array should reflect the action correctly
  • After submit/cancel, hit browser back/forward — the variation modal should not re-open into a stale Add state

🤖 Generated with Claude Code

Closes #144. The variation config editor modal was opened via
modalManager.open(), so umb-modal mounted an UmbContextBoundary for
UMB_ROUTE_CONTEXT instead of a real router-slot. Inside the modal,
uai-mock-entity (PR #125) could no longer consume UMB_ROUTE_CONTEXT,
its UmbModalRouteRegistrationController never fired, and the editor
route path never resolved — so selecting a sub-type silently did
nothing.

Switch the variation builder to UmbModalRouteRegistrationController +
history.pushState so the modal carries a router and the route context
chain stays intact for the entity context picker (and any other
route-registered editors hosted inside).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mattbrailsford mattbrailsford merged commit 9308e44 into dev May 5, 2026
23 of 25 checks passed
@mattbrailsford mattbrailsford deleted the feature/fix-variation-modal-route-context branch May 5, 2026 11:20
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.

[Tests] Selecting a document type in variation Entity Context picker does nothing

1 participant