DeborahK / Angular-NgRx-GettingStarted

Materials for our Pluralsight course: Angular NgRx: Getting Started: http://bit.ly/AngularNgRx.
MIT License
545 stars 724 forks source link

On delete, check current product id matches deleted product #45

Closed smanderson closed 2 years ago

smanderson commented 3 years ago

In product.reducer.ts on ProductActions.deleteProductSuccess (line 143) the currentProductId is set to null. Given the user can still interact with the app before the delete is successful or fails, it might be best to check the currentProductId matches the deleted product before setting the currentProductId to null. Left as is, the experience can be a bit jarring. I appreciate in a more "real world" example it might best to stop user interaction and wait for response which falls outside the scope of these lessons.

I would raise a PR but I'm not sure what the etiquette is for such things. Apologies if there is a preferred forum to raise this.

Great tutorial on Pluralsight - thank you!

duncanhunter commented 3 years ago

Hi

Yeah, that is totally a jarring experience :)

I agree with you in a more real-world example you would guard for this. I would love to accept a PR to fix it and you are kind to offer but we strive to keep the code and the video in sync. For this reason, I do not think we should change it until the next course update. I have made a note to address this when we do the next update.

No apologies needed here or the Pluralsight course forum is fine to raise issues and I am glad you enjoyed the course.

Here is the image of the experience with the time travel debugger for anyone wondering and listening in.

image