Fix: index constituent list (duplicate React keys, blank names) - #5
Open
mpont91 wants to merge 2 commits into
Open
Fix: index constituent list (duplicate React keys, blank names)#5mpont91 wants to merge 2 commits into
mpont91 wants to merge 2 commits into
Conversation
Every constituent comes back with an empty username, so the fund page rendered them all with key="" and React warned about duplicate keys. Uses rank instead, which the /api/fund/index endpoint already returns and is unique within an index, and falls back to "Trader #<rank>" so the rows aren't blank.
username is empty for every trader in aware_psi_index, so the fund page showed blank rows. /api/fund/index now also returns proxy_address (already in v_psi_index_current) and the pseudonym joined from aware_trader_profiles. The page falls back username -> pseudonym -> shortened address. Keeps an explicit ORDER BY weight DESC so the join doesn't disturb the ranking.
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.
Two problems on the fund page, both caused by
aware_psi_index.usernamebeing empty for every trader.Duplicate keys.
key={c.username}was""for all rows:Now uses
rank, which/api/fund/indexalready returns and is unique within an index.Blank names. With no username there was nothing to render, so the rows showed an empty name and avatar.
/api/fund/indexnow also returnsproxy_address(already present inv_psi_index_current) andpseudonym, joined fromaware_trader_profiles. The page falls back username -> pseudonym -> shortened address.Added an explicit
ORDER BY i.weight DESC, since the join would otherwise not be guaranteed to preserve the view ordering thatrankis derived from.Verified locally on PSI-10 and PSI-25: warning gone, ranks correlative and weights still descending, 17/19 constituents resolve to a pseudonym and the rest to an address.
tsc --noEmitclean.