Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parametrized hilla view not shown with automatic flow Layout and flowLayout=false #20261

Open
tltv opened this issue Oct 16, 2024 · 5 comments
Open
Assignees
Labels

Comments

@tltv
Copy link
Member

tltv commented Oct 16, 2024

Description of the bug

Parametrized Hilla file route like frontend/views/products/{productId}.tsx shows "Could not navigate to 'products/1'" error page when navigating for example to /products/1 path with export const config: ViewConfig = { flowLayout: false }; in the tsx and project has Layout annotation to enable automatic flow layout for the route.

Expected behavior

Hilla view is shown without flow main layout.

Minimal reproducible example

Download my-app.zip, unpack and run it and navigate to http://localhost:8080/products/1

Versions

Hilla: 24.5.0.rc2
Flow: 24.5.0.rc2 / 24.5.0
Vaadin: 24.5.0.rc2
Copilot: 24.5.0.rc2
Frontend Hotswap: Enabled, using Vite
OS: amd64 Windows 10 10.0
Java: JetBrains s.r.o. 17.0.11
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
Java Hotswap: Java Hotswap is enabled
IDE Plugin: 1.3.3 IntelliJ

@tltv
Copy link
Member Author

tltv commented Oct 16, 2024

Maybe this has something to do in here in Hilla file-router. I noticed that in generated file-routes.ts all flowLayout flags are true for some reason. Tested to switch them to false in the generated file and that made view show up again. Could you check this out @caalador?

@caalador
Copy link
Contributor

file-routes.ts gets true for all that have a possible layout (matching path in the layouts.json) and that true is overridden by the actual ViewConfig definition of the view.

@caalador
Copy link
Contributor

One issue is that /products/:productId doesn't match /products/1 so we would need some template matching to the hasClientRoute check.
The client side also seems to be quite tightly tide to the parent flowLayout state instead of the child state, so that would probably need some logic update so a child with flowLayout false is not going to the server when the parent has flowLayout true.
Also mixed use layouts for instance "platform/hello" layout true and "platform/hilla" layout false woudl both use the layout that is in "platform" and not what they define.

@caalador
Copy link
Contributor

Also on the file-routes.ts is you change only the createRoute("products", true, [ to createRoute("products", false, [ the parameterised route works, but not if you only change the child createRoute.

@tltv
Copy link
Member Author

tltv commented Oct 16, 2024

One issue is that /products/:productId doesn't match /products/1 so we would need some template matching to the hasClientRoute check.

That one needs a separate enhancement/bug ticket. Let's focus on the flowLayout=false issue here.

@tltv tltv added bug hilla Issues related to Hilla labels Oct 16, 2024
@caalador caalador self-assigned this Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants