tomastrajan / angular-ngrx-material-starter

Angular, NgRx, Angular CLI & Angular Material Starter Project
https://tomastrajan.github.io/angular-ngrx-material-starter
MIT License
2.82k stars 918 forks source link

No data on re-navigation #436

Closed indiealexh closed 5 years ago

indiealexh commented 5 years ago

Minimal reproduction of the bug with instructions:

Load the application Navigate to the Stocks page, let it load the data Navigate to any other page of the application Navigate to the Stocks page again The data will not load without a change of the input box

Expected behavior:

Data should always load on page load

Other information:

I would be willing to submit a PR to fix this issue:

[X] Yes (Assistance is provided if you need help submitting a pull request)

Although unsure what the issue is.

timdeschryver commented 5 years ago

Hi, thanks for filing the issue @indiealexh ! Would you mind taking a stab at it? Feel free to reach out whenever you want if you're stuck, perhaps we can push you in the right direction.

indiealexh commented 5 years ago

removing "distinctUntilChanged" 'fixes' the issue, but obviously, that is not a solution but a workaround. Not very confident with NGRX so unsure how best to trigger a load of already loaded data.

timdeschryver commented 5 years ago

You're spot on @indiealexh ! I think we could remove the distinctUntilChanged, but we'll also have to change the input. Now the event is bind to the keyup event which will invoke a new call every keystroke, also when we don't change the value but only use the arrows for example. We could use the input for this, which will trigger an event only when the value changes.

Thoughts?

tomastrajan commented 5 years ago

@timdeschryver @indiealexh i would keep keyup because change sometimes need blur to happen if I remember correctly, we could just debounce and then it shouldn't be a probable.

timdeschryver commented 5 years ago

If I remember correctly, change needs blur but input doesn't. But I'm also fine with debounce.

tomastrajan commented 5 years ago

Project went through major update to Angular 8, please open new issue if the behavior persists. ( Old issue cleanup)