mobilecoinofficial / desktop-wallet

A user-friendly desktop wallet.
Other
41 stars 10 forks source link

lift up history list state to history page #335

Open holtzman opened 5 days ago

holtzman commented 5 days ago

Motivation

When viewing an account history, if one navigates to an entry's details and then hits the "go back" button, it should take you back to where you were in the paginated history list.

In this PR

Caveats

This PR just passes the setters for firstToShow and selectedTabIndex into HistoryList, having lifted the state tracking up to HistoryPage. While the practice of directly sharing state setters into sub-components is generally frowned upon, that is for the use case of sharing state between sub-components and to make the code more debuggable when unexpected state changes happen.

We think in this case, it is acceptable because all of the setting is being done in HistoryList. We just need to lift these pieces of state up to the enclosing component as it removes HistoryList from the tree and then returns it later and we want this bit of state to survive that toggling of what is displayed.