From e3f3a33dc54e699cd9d34ff7c8c55cf839731f50 Mon Sep 17 00:00:00 2001 From: "krshivam2505@gmail.com" Date: Sun, 11 Oct 2026 13:52:32 +0530 Subject: [PATCH 1/2] fix(markets): keep the current market visible in the switcher when it is legacy The legacy group only renders while "Show legacy markets" is on, and that flag reset to false on every mount. A user viewing a legacy market therefore could not see it in the switcher and nothing appeared selected. Default the flag from the market being viewed instead. Closes #3128 --- src/components/MarketSwitcher.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/MarketSwitcher.tsx b/src/components/MarketSwitcher.tsx index ef291c6c33..54da67f24f 100644 --- a/src/components/MarketSwitcher.tsx +++ b/src/components/MarketSwitcher.tsx @@ -294,7 +294,6 @@ export const MarketSwitcher = ({ hideDescription }: MarketSwitcherProps) => { const [hovered, setHovered] = useState(false); const [focused, setFocused] = useState(false); const [searchQuery, setSearchQuery] = useState(''); - const [showLegacy, setShowLegacy] = useState(false); const searchRef = useRef(null); const triggerRowRef = useRef(null); @@ -307,6 +306,10 @@ export const MarketSwitcher = ({ hideDescription }: MarketSwitcherProps) => { const toggleFavoriteMarket = useRootStore((store) => store.toggleFavoriteMarket); const favoriteMarkets = useRootStore((store) => store.favoriteMarkets); + // A legacy market the user is actually on must not be missing from the list: the legacy + // group is only rendered while this is on, so default it from the market being viewed. + const [showLegacy, setShowLegacy] = useState(() => getMarketCategory(currentMarket) === 'legacy'); + const handleOpen = () => { setOpen(true); }; From 077a5e67db12bfd3695b9c1b36f632ac1f1377b4 Mon Sep 17 00:00:00 2001 From: "krshivam2505@gmail.com" Date: Sun, 11 Oct 2026 14:09:45 +0530 Subject: [PATCH 2/2] fix(markets): keep the legacy default in sync when the market changes The lazy initialiser runs only at mount, but the header survives shallow market changes and the store hydrates marketName from the URL after the first render, so the default could latch a stale false and hide the active legacy market again. Sync it whenever the current market becomes legacy. --- src/components/MarketSwitcher.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/MarketSwitcher.tsx b/src/components/MarketSwitcher.tsx index 54da67f24f..4fa434bf10 100644 --- a/src/components/MarketSwitcher.tsx +++ b/src/components/MarketSwitcher.tsx @@ -15,7 +15,7 @@ import { useMediaQuery, useTheme, } from '@mui/material'; -import React, { useMemo, useRef, useState } from 'react'; +import React, { useEffect, useMemo, useRef, useState } from 'react'; import { ArrowUpRightIcon } from 'src/components/icons/ArrowUpRightIcon'; import { ChevronUpDownIcon } from 'src/components/icons/ChevronUpDownIcon'; import { FAVOURITE_STAR_COLOR, StarIcon } from 'src/components/icons/StarIcon'; @@ -310,6 +310,14 @@ export const MarketSwitcher = ({ hideDescription }: MarketSwitcherProps) => { // group is only rendered while this is on, so default it from the market being viewed. const [showLegacy, setShowLegacy] = useState(() => getMarketCategory(currentMarket) === 'legacy'); + // The header stays mounted across shallow market changes, and the store hydrates `marketName` + // from the URL after the initial render, so the initialiser alone can latch a stale `false`. + useEffect(() => { + if (getMarketCategory(currentMarket) === 'legacy') { + setShowLegacy(true); + } + }, [currentMarket]); + const handleOpen = () => { setOpen(true); };