rockandrollwithemberjs / rarwe-issues

Errata and updates for the Rock and Roll with Ember.js book
https://rockandrollwithemberjs.com
43 stars 4 forks source link

Clarification needed for query parameters #522

Open waihon opened 3 years ago

waihon commented 3 years ago

I'm at a point where I've completed the "Using links instead of buttons" section.

Clicking the Title link has resulted in the URL shown without the query parameter: image

That is as explained on page 243:

When the value of the query param is its default value (as seen on the controller where we set sortBy), Ember doesn't add the QP to the URL.

However, when clicking on any of band links, except for "Pearl Jam" which has a description, the URL has a QP of s=title: image

Would you mind explaining a bit on why is that so?

balinterdi commented 3 years ago

This one seems complex. It's not that Pearl Jam doesn't show the QP in the URL and the other bands do: none of them do when you switch between sorting criteria while staying on the songs page of the same band. It's when switching bands that the s=title appears in the URL.

I recorded a screencast that shows this:

https://share.getcloudapp.com/z8u1r51J

My hunch is that this has something to do with updating the value of the backing controller property, sortBy. I don't think this is very important to understand but I'll try to find some time to think about this during the release of 4.0.

Thank you!

waihon commented 3 years ago

Thanks for the effort in recording a screencast! What I observed has been consistent with the screencast.

While I agreed that it might not be important to understand, it would still be nice to understand why s=title appears when switching bands (while the same QP doesn't appear when clicking Title as a sorting criterion [because title is the default value of sortBy] when staying on the songs page of the same band).