Skip to content

Conversation

@DejayJD
Copy link
Contributor

@DejayJD DejayJD commented Apr 25, 2025

Description

While doing the cache selector logic I noticed that we're doing some inefficient batch selector logic.
On all of our batch selects we were taking the response and doing Object.keys(entries).map(). This runs a lot and is technically unnecessary because the cache entries are already in a map format; they just have one nested property metadata. Most of the code changes here are just going one level deeper for .metadata
So I refactored that and it's usage.
Also in my profiling tests I found a few lingering spots where we're selecting data but not using it so I removed those as well

How Has This Been Tested?

ts is green ✅
code searched for all usage of getUsers/getTracks/getCollections and updated accordingly (types caught most of the issues)
QA-ed random features on app, haven't run into any issues

@DejayJD DejayJD requested a review from dylanjeffers April 25, 2025 16:33
@changeset-bot
Copy link

changeset-bot bot commented Apr 25, 2025

⚠️ No Changeset found

Latest commit: 0d8d44e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@DejayJD DejayJD changed the title Redux perf optimizations Redux batch selector optimizations Apr 25, 2025
@DejayJD DejayJD changed the title Redux batch selector optimizations Redux batch entity selector optimizations Apr 25, 2025
Copy link
Contributor

@dylanjeffers dylanjeffers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great improvement! and sounds like we will migrate most react-query stuff anyway so the double normalize wont matter as much?

export const getSearchResultsPageTracks = (state: CommonState) =>
getBaseState(state).trackIds || []

const getSearchArtistsIds = (state: CommonState) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assuming these are not needed anymore after our migration?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct! I just came across these unused

@DejayJD DejayJD merged commit 67ea24b into main Apr 28, 2025
7 of 9 checks passed
@DejayJD DejayJD deleted the jd/perf-optimizations branch April 28, 2025 19:19
audius-infra pushed a commit that referenced this pull request May 3, 2025
[3d7d0d6] [PE-6085] Remix contest started notification (#12021) Reed
[3d11415] Update to use pin icon (#12025) Farid Salau
[bb4b6e5] [PE-6059] Deprecate audius-query purchases.ts (#12007) JD Francis
[aa9ba24] Add global sentry error logging for tan-query (#11998) JD Francis
[45ce478] Add merged search / explore page  (#12016) Isaac Solo
[7c6979e] Fallback to null instead of 0 (#12014) Farid Salau
[e5be565] Update UserLinks to correctly contain and center text (#12013) KJ
[984be7a] Misc upload improvements (#12008) Ray Jacobson
[e67d435] [PE-6118] Fix view all submissions sometimes showing wrong parent track (#12006) Reed
[a2e7b7f] [PE-6115] Fix submissions label wrap on mobile remix contest section (#12002) Reed
[e0cfb31] [PE-6119] Mobile remix submission navigation.push (#12005) Reed
[e57b460] [PE-6116] Fix TextInput placeholder text too light (#12003) Reed
[ef7a9f3] [QA-2084] Small fixes for UserLinks and bedges (#12001) KJ
[aed1e89] Revert "Add react-devtools to mobile (#11996)" (#12004) Dylan Jeffers
[6066cda] Mobile remix section submission artwork pressable (#12000) Reed
[7fb503d] Don't show PlayBarChin in mobile remix parent lineup (#11997) Reed
[12e8505] [PE-6052] Deprecate user hooks from audius-query (#11992) JD Francis
[68af6dc] Add react-devtools to mobile (#11996) Dylan Jeffers
[fc0f6e8] Fix tooltip on cash wallet component (#11995) Farid Salau
[53b2a10] [PE-6107][PE-6104][PE-6102][PE-6101][PE-6100][PE-6099] Fix bugs found in QA for m1 wallet UI (#11987) Farid Salau
[7685ca3] Allow off curve accounts in USDC withdrawal (#11993) Marcus Pasell
[70c8c20] [PE-6103] Add colorSecondary option to icons, Fix verified and flair (#11990) Dylan Jeffers
[1b0f161] Change submissions tab formatting (#11988) KJ
[6acff10] Fix earn 5  purchase flow message on mobile (#11986) Reed
[36bef84] [PE-6063] Deprecate audius-query collection.ts (#11976) JD Francis
[18be409] Fix mobile remix contest prizes tab sometimes not appearing (#11984) Reed
[a4b8cd9] Horizontal margins for mobile remix contest info header (#11983) Reed
[b3b8fe0] [PE-5943] Tan query retry only on 400s (#11774) JD Francis
[1c1371b] [PE-6076] Deprecate useGetUserTracksByHandle (a-query) (#11971) JD Francis
[43fef98] Small fixes to submission tab styling (#11982) KJ
[ae6f9f7] Fix main (#11981) Farid Salau
[1035fe1] Use isPending instead of isLoading for balance loading state (#11978) Farid Salau
[f24bb7f] Small mobile tweaks for m1 wallet page (#11975) Farid Salau
[6c33a68] [PE-6075] Remove useGetTracksByIds from a-query (#11969) JD Francis
[993773b] [PE-6094] Drop bitcode from pods (#11979) Dylan Jeffers
[0979612] Add batching for events by entity ID (#11972) Isaac Solo
[64de118] [PE-6090] Add upload warning to unsaved-changes-dialog (#11973) Dylan Jeffers
[1341e31] Fix shadow on pay and earn page (#11942) Farid Salau
[6b2a059] [PE-6051] Fix scrolling inside remix contest info (#11964) Dylan Jeffers
[c64a609] Remove setUserId as email & stop calling identify on handle page (#11960) JD Francis
[2b59cf1] Fix mobile-web track description (#11965) Reed
[a7866ce] [PE-6074] Deprecate useGetTrackByPermalink from a-query (#11968) JD Francis
[7787431] Add gap back to the submissions tab (#11967) KJ
[1d52dfa] [PE-6077] Conditionally hide prizes tab in remix contest section (#11966) KJ
[0fd51f5] [PE-6073] Migrate useTrackByTrackId to useTrack (#11950) JD Francis
[aae9c9b] Reorganize query hooks (#11799) JD Francis
[4964258] [PE-6069] Fix remix submissions names overflow (#11963) Reed
[1c8446c] [PE-6078] Add borders to remix contest info and comment sections (#11959) KJ
[67ea24b] Redux batch entity selector optimizations (#11941) JD Francis
[adc2421] Fix contest sign center fill (#11962) Isaac Solo
[11b6dd9] [PE-6071] Overflow: hidden on remix contest info section (#11961) Reed
[8404bf8] [PE-6072] CollapsibleContent conditionally shows expand button (#11957) Reed
[dc50104] [PE-6067] Update submission artwork to go to track page (#11956) KJ
[6aeb767] [QA-2078] Fix mobile notification count (#11947) Dylan Jeffers
[4e84849] Fix flair positioning on mobile (#11952) Isaac Solo
[f8b90e7] [PE-5930, PE-6066] Upgrade react-native to 0.76.9 (#11955) Dylan Jeffers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants