ngneat / bind-query-params

Sync URL Query Params with Angular Form Controls

Home Page:https://netbasal.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Any ideas on how to handle custom route reuse?

benjamin-thomas opened this issue · comments

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[x] Feature request
[x] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:

Current behavior

When implementing a custom route reuse strategy, syncing breaks on route reuse. There doesn't seem to be an easy solution to this problem.

Expected behavior

I'm submitting this as I would like your input as the library author. You could have an idea that I'm not seeing at the moment.

@gili-lumigo I'd like your input too since you've just implemented a related feature.

Minimal reproduction of the problem with instructions

Please go to: https://angular-ivy-vrpb4j.stackblitz.io/form

Then:

  • fill in the form
  • notice that there is a long and annoying "slow request" displayed at the same time
  • click on "GO TO LIST"
  • then go back to the form by clicking on "GO TO FORM"

At this stage, you don't see the annoying slow request (that's the benefit of reusing this route). But unfortunately the syncing is broken (until each form control gets retouched).

What is the motivation / use case for changing the behavior?

At this stage, the form should either be reset because no params are set. Or the URL should reflect the current form value from the reused route.

Environment

Please see the stackblitz link. Repo is here: https://github.com/benjamin-thomas/angular-bind-query-params-demo