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

Router swallow Hilla or Flow route when both routes have the same name #20144

Open
abdullahtellioglu opened this issue Oct 4, 2024 · 5 comments · May be fixed by #20188
Open

Router swallow Hilla or Flow route when both routes have the same name #20144

abdullahtellioglu opened this issue Oct 4, 2024 · 5 comments · May be fixed by #20188

Comments

@abdullahtellioglu
Copy link
Collaborator

Description of the bug

When two views have the same name, one is created in Flow and the other one is created in Hilla

  • No exception is thrown, but it should
  • Flow view is shown in the browser by default
  • Hilla view is shown when Flow view has registerAtStartup = false

Expected behavior

I would expect an exception to be thrown.

Minimal reproducible example

Create a route view with Flow

@Route(value = "FooRoute", registerAtStartup = false)
@PageTitle("FooRouteButFlow")
@AnonymousAllowed
public class FooRoute extends HorizontalLayout {

    public FooRoute() {
add(new H1("test"));
    }
}

Create another route view with Hilla

import type { ViewConfig } from '@vaadin/hilla-file-router/types.js';

export const config: ViewConfig = {
  title: 'FooRoute',
};

export default function FooRoute() {
    return (
        <div className="flex flex-col">
            <h1>FooRoute In React</h1>
        </div>
    );
}

Versions

Hilla: 24.5.0.beta5
Flow: 24.5.0.beta4
Vaadin: 24.5.0.beta5
Copilot: 24.5.0.beta4
Frontend Hotswap: Enabled, using Vite
OS: aarch64 Mac OS X 14.6.1
Java: Oracle Corporation 22.0.1
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
Java Hotswap: Hotswap is not enabled
IDE Plugin: 1.3.3 IntelliJ

@caalador
Copy link
Contributor

caalador commented Oct 4, 2024

Is the client routes setup by file-router or manually configured?

@abdullahtellioglu
Copy link
Collaborator Author

From the file router. I created the Hilla view using Copilot Route panel.

@caalador
Copy link
Contributor

caalador commented Oct 4, 2024

Do you have in use also a @Layout server layout?
As by default Hilla should be the one to be chosen as it is on the client and would be the first exact match when navigating.

@abdullahtellioglu
Copy link
Collaborator Author

Autolayout is enabled, so there is no @Layout annotation

I created the repository for the issue https://github.com/abdullahtellioglu/hilla-flow-swallow-example/blob/main/src/main/frontend/views/HillaRouteTest.tsx

@caalador
Copy link
Contributor

caalador commented Oct 4, 2024

The MainLayout.java in the project has the Layout annotation.

@Layout
@AnonymousAllowed
public class MainLayout extends AppLayout {

So the normal case is that with conflicting routes the hilla route is rendered, but if there is a serverside layout in use for the hilla route, the Flow layout is rendered.

But will add somewhere a cross validation between Flow and Hilla routes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🔎Iteration reviews
Development

Successfully merging a pull request may close this issue.

3 participants