Skip to content

Commit

Permalink
LL-2041 - Fixes to persist all market page settings in store
Browse files Browse the repository at this point in the history
  • Loading branch information
nparigi-ledger committed May 24, 2022
1 parent 80ddb91 commit 497a628
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion apps/ledger-live-mobile/src/reducers/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,13 @@ export const INITIAL_STATE: SettingsState = {
lastSeenDevice: null,
starredMarketCoins: [],
lastConnectedDevice: null,
marketParams: {
marketRequestParams: {
range: "24h",
orderBy: "market_cap",
order: "desc",
liveCompatible: false,
sparkline: false,
top100: false,
},
marketCounterCurrency: null,
marketFilterByStarredAccounts: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ export default function MarketDataProviderWrapper({
countervalue={counterCurrency}
initState={{
requestParams: {
range: "24h",
limit: 100,
ids: [],
orderBy: "market_cap",
order: "desc",
search: "",
liveCompatible: false,
sparkline: false,
top100: false,
...marketRequestParams,
starred: filterByStarredAccount ? starredMarketCoins : [],
},
Expand Down
7 changes: 4 additions & 3 deletions apps/ledger-live-mobile/src/screens/Market/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@ const BottomSection = ({ navigation }: { navigation: any }) => {
const filterByStarredAccount: boolean = useSelector(
marketFilterByStarredAccountsSelector,
);
const firstMount = useRef(false); // To known if this is the first mount of the page
const firstMount = useRef(true); // To known if this is the first mount of the page

useEffect(() => {
if (!firstMount.current) {
firstMount.current = true;
if (firstMount.current) {
// We don't want to refresh the market data directly on mount, the data is already refreshed with wanted parameters from MarketDataProviderWrapper
firstMount.current = false;
return;
}
if (filterByStarredAccount) {
Expand Down

0 comments on commit 497a628

Please sign in to comment.