Skip to content

Commit b6522bf

Browse files
caaladortltv
andauthored
fix: more robust Server route check (#19063)
* fix: more robust Server route check Make server route validation not use path but element instead. * Update flow-server/src/main/resources/com/vaadin/flow/server/frontend/Flow.tsx Co-authored-by: Tomi Virtanen <tltv@vaadin.com> --------- Co-authored-by: Tomi Virtanen <tltv@vaadin.com>
1 parent f817aa0 commit b6522bf

File tree

1 file changed

+4
-2
lines changed
  • flow-server/src/main/resources/com/vaadin/flow/server/frontend

1 file changed

+4
-2
lines changed

flow-server/src/main/resources/com/vaadin/flow/server/frontend/Flow.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ function navigateEventHandler(event) {
168168

169169
// if navigation event route targets a flow view do beforeEnter for the
170170
// target path. Server will then handle updates and postpone as needed.
171-
if(matched && matched.length > 0 && matched[matched.length - 1].route.path === "/*") {
171+
// @ts-ignore
172+
if(matched && matched.filter(path => path.route?.element?.type?.name === Flow.name).length >= 1) {
172173
if (mountedContainer?.onBeforeEnter) {
173174
// onBeforeEvent call will handle the Flow navigation
174175
mountedContainer.onBeforeEnter(
@@ -309,7 +310,8 @@ export default function Flow() {
309310
// flow from the view
310311
// If we are going to a non Flow view then we need to clean the Flow
311312
// view from the dom as we will not be getting a uidl response.
312-
if(matched && matched[matched.length - 1].route.path !== "/*") {
313+
// @ts-ignore
314+
if(matched && matched.filter(path => path.route?.element?.type?.name === Flow.name).length == 0) {
313315
mountedContainer?.parentNode?.removeChild(mountedContainer);
314316
mountedContainer = undefined;
315317
}

0 commit comments

Comments
 (0)