perf: remove trace/traceDpp from eager queries and slim FETCH_RESOURCES - #881
Merged
Merged
Conversation
Problem: production GUI times out loading zenflows assets because: 1. Project detail page fires 5 expensive trace/traceDpp queries simultaneously, each triggering full event-chain DFS traversals in the backend. 2. FETCH_RESOURCES (listing pages) fetches heavy unused fields including base64 image binary data, unused DB preloads per resource. Changes: - Remove trace from GET_PROJECT_LAYOUT (FetchProjectLayout) - Remove eager QUERY_TRACE_DPP from ProjectTabs and ContributionsCard, use project.metadata?.dpp fallback instead - Remove GET_TRACE query from ProjectTime (was dead code) - Remove GET_PROJECT_TRACE from LoshImportedDate, simplify to prop - Fix broken e.trace?.filter(...)[0] in ProjectsTableRow - Slim FETCH_RESOURCES: remove primaryAccountable.images.bin, custodian, accountingQuantity, onhandQuantity, okhv, repo, version, licensor, primaryAccountable.note/primaryLocation - Make getUserImage() safe when bin is missing
…jectId prop - ContributionsCard.tsx: the traceDpp removal left the QUERY_RESOURCE_PROPOSAlS useQuery call unclosed and its @apollo/client import removed, causing a build parsing error. Restore the query args, closing paren and import. - LoshImportedDate.tsx: projectId prop is no longer used; remove it from the props type so call sites passing only addedOn typecheck.
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.
Problem
Production GUI times out loading zenflows assets because:
1. Project detail page fires 5 expensive queries simultaneously
Each triggers a full event-chain DFS traversal in the zenflows backend:
GET_PROJECT_LAYOUTwithtrace(FetchProjectLayout)GET_TRACEwithtrace(ProjectTime)GET_PROJECT_TRACEwithtrace(LoshImportedDate)QUERY_TRACE_DPPwithtraceDpp(ProjectTabs)QUERY_TRACE_DPPwithtraceDpp(ContributionsCard)Backend detail:
tracetriggersEconomicResource.Domain.trace/2which does a depth-first search through the entire event chain.traceDppis worse —trace_dpp/2recursively walks the trace graph with depth 100M, each recursion wrapped inRepo.multiDB transactions.2. FETCH_RESOURCES fetches heavy unused fields per resource
primaryAccountable.images.bin— base64 binary image data (HUGE payload)custodian— DB preload, never used in cardsaccountingQuantity/onhandQuantity—Measure.preloadeach, never used in cardsokhv,repo,version,licensor,primaryAccountable.note,primaryAccountable.primaryLocation— unused stringsChanges
tracefromGET_PROJECT_LAYOUTQUERY_TRACE_DPPfrom ProjectTabs & ContributionsCard, useproject.metadata?.dppfallbackGET_TRACEfrom ProjectTime (was dead code, never imported)GET_PROJECT_TRACEfrom LoshImportedDate, simplify to optional prope.trace?.filter(...)[0]crash in ProjectsTableRowFETCH_RESOURCES: removed 10 unused/heavy fieldsgetUserImage()safe whenbinis missingFETCH_RESOURCESupdate in interfacer-client (already pushed)What's preserved
ProjectDpp.tsxstill fetchestraceDpplazily — only when user clicks the DPP tabcurrentLocationkept inFETCH_RESOURCES(used by maps and some cards)