I'll keep the questions coming 😄
# package-development
m
I'll keep the questions coming 😄 I have a routed modal, that is connected (using
UmbModalRouteRegistrationController
) to a element on this route:
Copy code
section/newsletter-studio/workspace/campaign/edit/ACA0F7A1-9AD5-4318-B1FB-A04A5CCCAE75/test
Use this code to open the modal:
Copy code
<a href=${this._routeBuilder?.({myId:'123',workspaceKey : this.workspaceKey})??""}>Route 123</a>
The modal is opened, looks fine and the route now looks like this.
Copy code
/section/newsletter-studio/workspace/campaign/edit/:workspaceKey/test/modal/ns-modal-campaign-emailsection/foo-2bar/123/
The problem is when I close the modal (submit or reject does not matter), the route is changed to:
Copy code
section/newsletter-studio/workspace/campaign/edit/:workspaceKey/test
Note that the GUID is gone and replaced with :workspaceKey (the name of the route parameter). Like it's loosing the :workspaceKey that used to be in the route. I have similar (almost the exact code) mounted in a workspaceView inside the content-section and in that there everything works just fine, the route changes back to the previous view. I think I'm missing something here but I've sent 3-4 hours trying to understand what I'm doing wrong =/. Any pointers or ideas? Anyone seen something similar? Would it be that the routed modal requires something like a workspaceView? Like mentioned I use
element()
on the workspace extension definition:
Copy code
.... {
  type: "workspace",
   ....
  element : () => import("./ns-campaign-workspace.element.js"), // <<<<< This is the element with <umb-router-slot/>
};
Then inside
ns-campaign-workspace.element.js
I have one route (that displays well) where the
UmbModalRouteRegistrationController
is added. The fact that I manually need to pass the "workspaceKey" like so
<a href=${this._routeBuilder?.({myId:'123',workspaceKey : this.workspaceKey})??""}>Route 123</a>
was the first thing that felt strange,
I just upgraded from beta001 to beta002 and problem was solved. Don't ask me why I did not try that sooner 😄
n
Good that it fixed it.
Do notice the DX of RoutableModals are quite complex, has not be polished yet. Also do make sure that your URLs wont collide — by adding addtionalPath or uniquePathParts.. We do open workspaces from quite a few places.. one example is the workspace view Info on Documents. I'm not sure what you use the workspaceKey for?, is that the workspaceAlias?
6 Views