You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using client-side routing in a Vaadin 15+ app I want to have a flow.navigate instance property on the flow object that works as a custom route action for Vaadin Router, so that I can delegate to server-side routing from the client-side routing config.
Example:
import{Router}from'@vaadin/router';import{Flow}from'@vaadin/flow';constflow=newFlow({imports: ()=>import('./generated/flow-imports.js')});constroutes=[{path: '/',module: import('./main-layout'),children: [{path: '/client-side',module: ()=>import('./client-side-view')},{// fall back to server-side routing if no client-side routes matchpath: '(.*)',action: flow.navigate}]}];constrouter=newRouter(document.body);router.setRoutes(routes);
Create a DOM structure for a given URL and return to the client to be inserted into the router outlet by Vaadin Router. It’s based on a server-side @Route class. This is the API to use in the client-side router configuration.
Flow's client engine should be initialized the first time the method is run
When using this method, Flow should not listen to router-link and popstate events. Furthermore, Flow should not attach the navigation target directly to <body>, but other things attached to the UI (e.g. <vaadin-notification> instances) should still be attached. One way of doing this would be that the navigation target component is attached as a virtual child and then the id of that child is passed back to the client. (This is thus the same mechanism as is used by Flow's component renderer)
The navigate method needs to be bound to the right flow instance, so it cannot just be a regular class function. Constructor could do something like this.navigate = this.internalNavigate.bind(this);.
Need to test what happens when someone calls navigate before the previous call has resolved?
Does not need to fire any server-side navigation events at this point (will be implemented separately)
Server-side handler that processes the ‘navigate’ requests
Could/should potentially be implemented using ReturnChannelMap
The text was updated successfully, but these errors were encountered:
Create a DOM structure for a given URL and return to the client to be inserted into the router outlet by Vaadin Router. It’s based on a server-side @route class. This is the API to use in the client-side router configuration.
When using this method, Flow should not listen to router-link and popstate events. Furthermore, Flow should not attach the navigation target directly to , but other things attached to the UI (e.g. instances) should still be attached. One way of doing this would be that the navigation target component is attached as a virtual child and then the id of that child is passed back to the client. (This is thus the same mechanism as is used by Flow's component renderer)
The navigate method needs to be bound to the right flow instance, so it cannot just be a regular class function. Constructor could do something like this.navigate = this.internalNavigate.bind(this);.
Need to test what happens when someone calls navigate before the previous call has resolved?
Does not need to fire any server-side navigation events at this point (will be implemented separately)
Server-side handler that processes the ‘navigate’ requests
When using client-side routing in a Vaadin 15+ app I want to have a
flow.navigate
instance property on theflow
object that works as a custom route action for Vaadin Router, so that I can delegate to server-side routing from the client-side routing config.Example:
@Route
class. This is the API to use in the client-side router configuration.<body>
, but other things attached to the UI (e.g.<vaadin-notification>
instances) should still be attached. One way of doing this would be that the navigation target component is attached as a virtual child and then the id of that child is passed back to the client. (This is thus the same mechanism as is used by Flow's component renderer)this.navigate = this.internalNavigate.bind(this);
.ReturnChannelMap
The text was updated successfully, but these errors were encountered: