flow icon indicating copy to clipboard operation
flow copied to clipboard

navigation issue with hybrid application

Open ZheSun88 opened this issue 3 months ago • 8 comments

Describe the bug

Using 24.4.0.beta2 in a hybrid application causes a blank UI after navigating between different routes image

Expected-behavior

UI are loaded correctly.

Reproduction

download the app using this preset https://start.vaadin.com/dl?&preset=test-hybrid-react&projectName=test-hybrid-react&preset=partial-prerelease
unzip
./mvnw
navigate to localhost:8080 [1]
click Hello Hilla
click Hello Flow [2]
  • [1] image

  • [2] the url goes to about:blank#blocked and leave a blank screen image

System Info

Vaadin: 24.4.0.beta2

ZheSun88 avatar May 14 '24 13:05 ZheSun88

some discussions are posted in https://github.com/vaadin/hilla/issues/2408

ZheSun88 avatar May 14 '24 13:05 ZheSun88

When opening / you already see

image

Artur- avatar May 14 '24 13:05 Artur-

The path for the first nav item is set to // which is causing the issue

Artur- avatar May 14 '24 13:05 Artur-

image

mcollovati avatar May 14 '24 14:05 mcollovati

@Artur- is this related on how start ships the application, or should it fixed in hilla?

manolo avatar May 16 '24 06:05 manolo

well, seems that is a flow issue how it propagates the routes to the menu

manolo avatar May 16 '24 07:05 manolo

The application contains a @Route(value = "/:samplePersonID?/:action?(edit)") view and the main problem is that this URL is added as-is to the menu even though you cannot navigate to that URL.

  • Optional parameters should be left out from the URL in the menu.
  • Views with non-optional parameters should not be shown in the menu at all.

This is basically the same logic that should also be in the default 404 view in dev mode so there might be an opportunity to share some code there.

There's also a secondary issue about how trying to navigate to a nonsensical URL like that leads to a redirect to #blocked but that might just be the way React Router deals with special characters that should really be escaped in URLs.

Legioth avatar May 16 '24 07:05 Legioth

Fix should go to Hilla for 24.4 (RouteUnifyingIndexHtmlRequestListener) and to flow for 24.5 (MenuRegistry). Code that transforms server routes into AvailableViewInfo was moved to Flow.

tltv avatar May 16 '24 08:05 tltv