Routing problems, maybe with default generic filters

Jmix 2.3.3

Summary
When navigating to list views with default generic filters, the correct view is displayed, but the URL is wrong - it is either missing the route, or has the route from the previous view. This may have started with 2.3.2

Detail
I have 2 main entities in my application: Members and School. Because different users have different business needs, I have 3 list views for Members (main, exam, and insurance) and 2 list views for School (main and insurance). Each has their own menu item.

Each of the different views has a unique route and view controller name. For example, the Main School view controller has:

@Route(value = "schools", layout = MainView.class)
@ViewController("School.list")
@ViewDescriptor("school-list-view.xml")
@LookupComponent("schoolsDataGrid")
@DialogMode(width = "64em")
public class SchoolListView extends StandardListView<School> {

The menu definition is:

<item view="School.list" description="msg:///menu_config.School.list.description"
              title="msg://com.company.membership.view.school/schoolListView.title" icon="vaadin:building"/>

and the Insurance School list controller has:

@Route(value = "insschools", layout = MainView.class)
@ViewController("InsSchool.list")
@ViewDescriptor("ins-school-list-view.xml")
@LookupComponent("schoolsDataGrid")
@DialogMode(width = "64em")
public class InsSchoolListView extends StandardListView<School> {

The menu entry is:

<item view="InsSchool.list" title="msg://com.company.membership.view.school/insSchoolListView.title"
              icon="vaadin:building"/>

On most of the list views I have default generic filters saved without any values. When I navigate to the list view, I get the generic filter fields displayed automatically as expected.

Now for the problem. When I first log in and navigate to the Main School list, I get the correct view, but the URL is:

http://localhost:8080/?genericFilterCondition=property%3Acode_equal_&genericFilterCondition=property%3Aname_contains_&genericFilterConfiguration=Code-NameNrQblyPN

As you can see the route is missing. If I then navigate to the Insurance School list, I get the correct view displayed, but the URL is:

http://localhost:8080/?genericFilterCondition=property%3Aname_contains_&genericFilterConfiguration=ByNameGZZpKtGl

As long as I navigate to list views with default generic filters, the URL is missing the route. Even if I navigate to the Main Members list view, I get the correct view, but the URL is:

http://localhost:8080/?genericFilterCondition=property%3AmemberNumber_equal_&genericFilterCondition=property%3AlastName_starts-with_&genericFilterConfiguration=Number-NameYSISVuFH

Now if I navigate to a list view without any default generic filter (for example the Exam Members list), I get the correct URL:

http://localhost:8080/examMemberses

But if I then navigate back to a list view with default filters, I get the correct view, but the wrong URL. For example, if I navigate to Main School list I get:

http://localhost:8080/examMemberses?genericFilterCondition=property%3Acode_equal_&genericFilterCondition=property%3Aname_contains_&genericFilterConfiguration=Code-NameNrQblyPN

Follow-up: if I remove the <genericFilter component="genericFilter"/> from the urlQueryParameters in the view XML, then I get the correct URL. This is not a viable solution as when I filter on a list view, then edit an entity, then cancel back to the list view, the previous filter is lost.

1 Like

Hi
This looks like a bug. I couldn’t reproduce this behavior on my test project. Could you please provide a test project where the bug is reproduced?

Best regards,
Dmitriy

Here are simpler steps to reproduce:

  • Create new full stack project
  • Modify user-list-view.xml by adding facet <settings auto="true"/>
  • start application
  • log in as admin
  • navigate to user list view
  • add a generic filter field. I chose username field.
  • save filter as. I used “by user name”
  • make filter the default
  • navigate to resource roles view so user list view can save settings
  • navigate back to user list view
  • URL has route of previous page:
http://localhost:8080/sec/resourcerolemodels?genericFilterCondition=property%3Ausername_contains_&genericFilterConfiguration=ByUserNamebkljZahQ

From this point you can also log out/back in, navigate straight to user list view and see URL:

http://localhost:8080/?genericFilterCondition=property%3Ausername_contains_&genericFilterConfiguration=ByUserNamebkljZahQ
1 Like

This may be related to Issue 3654

Yes, you are right.
With these steps, reproducing is the same issue.

I was confused by the lack of a route in most of your examples. However, it was probably related to the redirect from the mainView.

This issue is related to the asynchronous fetch of the URL from the client-side by calling JS function. To fix the bug, you can use the temporary workaround provided in the issue description.

Please let me know if it worked for you.

Best regards,
Dmitriy