Skip to content

Problem with reloadOnSearch: false - change in stateParams doesn't reload  #1079

Closed
@OriaLogic

Description

@OriaLogic

Here is my issue:

I navigate through a list of links, that display different images depending on the date in the search parameters (?from&to).

Those search parameters should not trigger a state reload. Finally, here is my state declaration:

state('links/:linkId', {
  url: "/links/linkId?from&to",
  reloadOnSearch: false,
  templateUrl: ...
  Controller: ...
});

But then a huge problem shows up! When I try to navigate through my different links, reload doesn't happen anymore, so that I cannot pass from one link to another.

After some digging in the code, I found out that when reloadOnSearch equals to false, triggers are always blocked because there's absolutely no checking of whether the changing parameters are search parameters or path parameters.

So actually, reloadOnSearch doesn't work as intended and should be renamed reloadOnStateParamsChange.

I fixed the issue by checking if the state parameters that changed are search parameters or not, which seems to work fine.

Please tell me if I'm mistaking somewhere or if it is relevant, and also if you would be interested in a pull request or a plunkr.

Thanks in advance!

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions