Open Closed

Page not refreshed and filters not cleared when clicking on menu item #7084


User avatar
0
Angelo_Nestola created
  • ABP Framework version: v8.1.1
  • UI Type: Angular
  • Database System: EF Core (SQL Server)
  • Tiered (for MVC) or Auth Server Separated (for Angular): no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hello, when I am on a page and I click on its menu item, the page is not refreshed. This happens also when I have query parameters. The filters are not cleared too. This causes a behavior in which if I filter through navigation using query parameters and then I try to go back to the non-filtered list, nothing happens.

Thank you


4 Answer(s)
  • User Avatar
    0
    yusuf.cirak created
    Support Team Angular Developer

    Hi,

    As i understand you have your own implementation to pass query parameters to advanced query filters form. When you click the route through sidebar, it does not refresh.

    router.navigateByUrl('some-route', { onSameUrlNavigation: 'ignore' });
    

    This is the default behavior of Angular Router.

    I think we have two solutions here.

    1 - Changing the routing behavior of Angular Router might help to solve your issue.

    const MY_MODULE_ROUTE_PROVIDER = [
      provideRouter(
        [{ component: MyComponent, path: 'my-component' }],
        withRouterConfig({ onSameUrlNavigation: 'reload' }),
      ),
    ];
    

    or,

    @NgModule({
      imports: [RouterModule.forRoot(routes, { onSameUrlNavigation: 'reload' })],
      exports: [RouterModule],
    })
    export class AppRoutingModule {}
    

    2 - Replace RoutesComponent by following the steps in this link

  • User Avatar
    0
    Angelo_Nestola created

    Hello, I have already tried solution 1. but it doesn't work. The problem is that I also tried to add a query param to the url. When I click on the menu item corresponding to my current page, it removes the param from the url, but the page is not refreshed. I think it's a bug in the side menu and not a behavior of the Angular Router, since it doesn't work also when changing the url.

    Thank you

  • User Avatar
    0
    yusuf.cirak created
    Support Team Angular Developer

    Hi,

    I debugged the application and all the click events and also routerLink works without issue.

    I also looked into Angular Router and it seems onSameUrlNavigation is not actually reloading the component. It only triggers guards and resolvers of the route. Which is not actually what we want here. I also checked that guards and resolvers are not always getting triggered. This might cause issues so i want to share this link.

    We handle routing by using RouterLink in side menu and extending or changing this behavior is not available atm.

    There are suggestions about using router events to handle some logic inside your component. Do you think this might help to solve your problem?

  • User Avatar
    0
    Angelo_Nestola created

    Hello! These two links helped fixing my problem.

    Thank you very much!

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11