Skip to content

Conversation

@chulinguy
Copy link
Owner

@chulinguy chulinguy commented Aug 31, 2023

Why was this change made?

We need to be able to favorite a dance move and have that persist if the page is reloaded.

What was the previous state

Previously, state was stored in memory so if you reloaded the page, it didn't save any changes. In this case, if you clicked the favorite button, it would be reset to unselected on a reload.

What is the current state

We added LocalStorage as a middleware to the redux Store and set up a listener so that if state changes, it will persist it in LocalStorage. Hence, if you favorite a move and reload the page, you will see that the move is still favorited.

Test Plan

  1. Select a move
  2. Click on the favorite button (heart)
  3. Reload the page. You should see the heart still selected.
  4. Click on the favorite button again to unfavorite it.
  5. Reload the page. You should see the heart is still unselected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants