vaadin / full-stack-starter

Public repository for Full Stack Starter issues
https://vaadin.com/start
1 stars 0 forks source link

Custom route issue on 10.0.4 #16

Closed gianluca-valentini closed 6 years ago

gianluca-valentini commented 6 years ago

Hi, There is an issue on v 10.0.4 that was not present on 10.0.2.

V10.0.2 Use bakery application. Write a custom not managed route (for example sue dashboard1 instead of dashboard). You have the CustomRouteNotFoundError message

image

Updating the Bakery app to 10.0.4 we have the error trace instead

image

The same code on Vaadin 10.0.2 works fine while using 10.0.4 give me the exception on the UI.

Something about exception handling broke off from 10.0.2 to 10.0.4

alvarezguille commented 6 years ago

Thanks for reporting this. The issue can be prevented in AppNavigation.java by changing afterNavigation method to only set the selected tab when possible.

    @Override
    public void afterNavigation(AfterNavigationEvent event) {
        String href = event.getLocation().getFirstSegment().isEmpty() ? defaultHref
                : event.getLocation().getFirstSegment();
        currentHref = href;
        if(hrefs.contains(href)) {
            tabs.setSelectedIndex(hrefs.indexOf(href));
        }
    }

Specific issue has been created in vaadin/vaadin-tabs-flow#72

gianluca-valentini commented 6 years ago

Thank you, your java fix is perfect. However, my attempt was to point out that from 10.0.2 to 10.0.4 there seems to be a different handling of exceptions.

Because the same code has different result just changing the Vaadin version. Thanks Gianluca

alvarezguille commented 6 years ago

I'm not sure if it's about handling of exceptions, or just that there was no exception before. Anyway it seems to be a regression and we'll take a deeper look. Thanks again. I will close this issue once bakery starter with the fix is released. vaadin/vaadin-tabs-flow#72 can be used to track the underlying issue

alvarezguille commented 6 years ago

vaadin-tabs-flow version 1.0.5 was released including a fix for the underlying issue. and the workaround of hrefs.contains(href) is not needed anymore. Starter was updated to include Vaadin 10.0.5 and tabs 1.0.5 and is available in vaadin.com/start