Repository navigation
Conversation
… 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 aave#3128
|
@Krshivam25 is attempting to deploy a commit to the Aave Team on Vercel. A member of the Team first needs to authorize it. |
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.
shivam-V8
commented
Oct 11, 2026
This was referenced Oct 14, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
General Changes
Developer Notes
Root cause —
showLegacywas initialised tofalseand never persisted, so it reset on every mount regardless of the market being viewed. The legacy group only renders while that flag is on, andisSelectedcan only highlight an item that is rendered.Change — two parts:
useRootStorereads (at its previous positioncurrentMarketis not yet defined, so referencing it there is a temporal-dead-zone error) and derives its default from the current market, reusing the existing module-levelgetMarketCategoryhelper.The effect is not redundant with the initialiser. setQueryParameter uses Router.push(..., { shallow: true }), so a market change never remounts the header; and src/store/root.ts hydrates currentMarket from ?marketName/localStorage inside document.onreadystatechange, i.e. after the store initialises to availableMarkets[0] (Core, non-legacy). Without the effect, a switcher that mounts before hydration latches a stale false on exactly the deep-link path this issue describes. The initialiser is kept so there is no flash when the market is already known at mount.
This came from the automated review on the first commit; the finding was accepted and 077a5e6 addresses it.
Behaviour worth flagging — the effect only ever sets true, so once a legacy market has been visited the section stays expanded for the rest of that mount, even after switching to a non-legacy market. A fresh page load on a non-legacy market still starts collapsed. Mirroring both ways would override a user's deliberate "on" toggle whenever they moved to a non-legacy market, which seemed worse — happy to switch to the stricter behaviour if you prefer it.
tsc --noEmit and next lint are clean for this file (exhaustivjest baseline is unchanged.
Relationship to #3129 — independent. That PR fixes the search half of the same area (#3127) and touches the import block, noResults and the legacyrender guard; this one touches the React import and the state declaration. They merge in either order. No unit test here for the same reason: the pure helpers introduced by #3129 live in a file that does not exisng it here would make the two PRs conflict. Happy to follow up with a test once #3129 lands.
Pre-existing failures — the 4 jest suites in src/utils/ that fail on main (a wagmi/chains import issue) are unaffected.
Reviewer Checklist
Please ensure you, as the reviewer(s), have gone through this checklist to ensure that the code changes are ready to ship safely and to help mitigate
any downstream issues that may occur.
Related work
Part of a set of small, independently reviewable fixes found while testing the v3 uplift. Each closes its own issue, touches one concern, and branches from
main, so they can be reviewed and merged in any order: