Skip to content

fix(markets): show legacy markets matching the switcher search - #3129

Open
shivam-V8 wants to merge 1 commit into
aave:mainfrom
shivam-V8:fix/3127-legacy-market-search
Open

shivam-V8 wants to merge 1 commit into
aave:mainfrom
shivam-V8:fix/3127-legacy-market-search

Conversation

@shivam-V8

Copy link
Copy Markdown

Searching for a legacy market rendered "No markets found": the match landed in the legacy group, which only renders when the "Show legacy markets" switch is on, and noResults never counted that group. An active search now reveals matching legacy markets regardless of the switch, and noResults accounts for them.

Closes #3127

General Changes

  • Fixes bug: market switcher search reports "No markets found" for legacy markets #3127: searching for a legacy market (Gnosis, Sonic, Scroll, Metis, ZKsync, Soneium, EtherFi) rendered "No markets found" even though the market matched the query.
  • An active search now reveals matching legacy markets regardless of the "Show legacy markets" switch.
  • noResults now counts the legacy group, so a legacy-only match no longer renders the empty state.

Developer Notes

Root cause — two things combined in src/components/MarketSwitcher.tsx:

  1. The search filter runs first and the match lands in the legacy group, but that section only renders when the "Show legacy markets" switch is on.
  2. noResults counted pinned, ethereum, l2, other, v4Ethereum and v4Other — never legacy. With a legacy-only match every counted group is empty, so the empty state rendered on top of a match that existed.

Both halves are needed: fixing only noResults would have replaced the wrong message with a blank panel, since the matching section still would not render.

Approach — the two predicates are extracted to src/components/marketSwitcher.utils.ts as pure functions with no imports, so they are unit-testable without rendering React or mocking the store. MarketSwitcher.tsx changes in three places: the import, the noResults expression, and the legacy section's render guard.

Behaviour note — the switch keeps its meaning as a persistent preference, so it can read "off" while search results show legacy markets; clearing the search collapses them again. Happy to change this to only reveal legacy when it is the sole matching group if you'd prefer the narrower rule.

Tests — src/components/__tests__/marketSwitcher.utils.test.ts, 8 pure-logic cases matching the repo's existing style, including the two regression guards (searched legacy market is shown; a legacy-only match is not reported as "no results").

Scope — this does not touch showLegacy's initialiser; that is #3128, which I'll send as a separate PR on top.

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.

  • End-to-end tests are passing without any errors
  • Code changes do not significantly increase the application bundle size
  • If there are new 3rd-party packages, they do not introreats
  • If there are new environment variables being added, they have been added to the .env.example file as well as the pertinant .github/actions/* files
  • There are no CI changes, or they have been approved by the DevOps and Engineering team(s)

Searching for a legacy market rendered "No markets found": the match landed in the
legacy group, which only renders when the "Show legacy markets" switch is on, and
noResults never counted that group. An active search now reveals matching legacy
markets regardless of the switch, and noResults accounts for them.

Closes aave#3127
@vercel

vercel Bot commented Oct 11, 2026

Copy link
Copy Markdown

@Krshivam25 is attempting to deploy a commit to the Aave Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

bug: market switcher search reports "No markets found" for legacy markets

2 participants