whole-tale / dashboard

Whole Tale Dashboard
http://wholetale.org
MIT License
7 stars 2 forks source link

Remember the state of filters on Browse view #599

Closed bodom0015 closed 4 years ago

bodom0015 commented 4 years ago

Problem

The Browse view doesn't remember the state of the selected filters.

Fixes #564

Approach

How to Test

  1. Checkout and run this branch locally, rebuild the dashboard
  2. Login to the WholeTale Dashboard
  3. Navigate to the Browse view
    • Filter should default to All Tales
  4. Toggle to My Tales and refresh the page
    • You should see that My Tales is selected by default
  5. Click "View" on a Tale, then click the Back button
    • You should see that My Tales is still selected by default
craig-willis commented 4 years ago

I may be misunderstanding, but this doesn't appear to be working for me. I tried capturing here https://recordit.co/SirrdwyySP, but it may be be entirely clear.

If I change the filter without refreshing, then go to view or manage and back to the dashboard, the filter resets. If I change the filter and refresh then it works as described. It seems that the refresh is persisting the filter?

ThomasThelen commented 4 years ago

I ran through the test steps fine, but I was expecting the filter to be set without needing the refresh and resetting on the refresh.

bodom0015 commented 4 years ago

Good catch! Sorry about that - I had apparently only been testing using refresh, and not by actually navigating.

@craig-willis was correct and somehow my first commit was misbehaving because the getItem was only being called after a refresh (and not everytime the view loaded). I think I've corrected it now if you're willing to take another look.

@ThomasThelen I'm not sure what you mean by "resetting on the refresh", as I was thinking that this feature was meant to persist between refreshes. Perhaps I am misunderstanding?

Verified that the following now works, which I think captures the full issue and all edge cases:

  1. Select "Mine" as filter, click "View", then click "Back" - "Mine" is still selected
  2. Navigate to "Manage" and then click "Back" - "Mine" is still selected
  3. Navigate to "Settings" and then click "Back" - "Mine" is still selected
  4. Refresh the view - "Mine" is still selected
  5. Select "All" as filter, click "View", then click "Back" - "All" is still selected
  6. Navigate to "Manage" and then click "Back" - "All" is still selected
  7. Navigate to "Settings" and then click "Back" - "All" is still selected
  8. Refresh the view - "All" is still selected
ThomasThelen commented 4 years ago

I wasn't sure what the expected behavior was-but I generally expect page refreshes to reset most UI elements (which might be an incorrect assumption). If no one else thinks so, then this PR looks good to me!