listing: skip amiChart findMany when no units carry an AMI chart#6316
Open
c-tonneslan wants to merge 1 commit into
Open
listing: skip amiChart findMany when no units carry an AMI chart#6316c-tonneslan wants to merge 1 commit into
c-tonneslan wants to merge 1 commit into
Conversation
When addUnitsSummarized runs against a listing pulled with a view that doesn't select amiChart, every unit.amiChart?.id is undefined, so unitsWithCharts ends up empty and we issue prisma.amiChart.findMany with an 'in: []' filter. That's enough to trip up downstream callers that expected the base path to not hit the AMI chart table at all, which is what was happening on account/application/[id]. Short-circuit the findMany when unitsWithCharts is empty. Closes bloom-housing#5684. Signed-off-by: Charlie Tonneslan <cst0520@gmail.com>
👷 Deploy request for bloom-angelopolis pending review.Visit the deploys page to approve it
|
👷 Deploy request for partners-bloom-msq2 pending review.Visit the deploys page to approve it
|
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.
Per the diagnosis @ludtkemorgan put in #5684: when
addUnitsSummarizedruns against a listing pulled with a view that doesn'tselectamiChart, everyunit.amiChart?.idis undefined,unitsWithChartsends up empty, and we still issueprisma.amiChart.findMany({ where: { id: { in: [] } } }). That's enough to trip up downstream callers expecting the base path not to hit the AMI chart table, which is what's breakingaccount/application/[id](the listing title doesn't load).Short-circuit
findManywhenunitsWithChartsis empty.Closes #5684. Happy to also tackle the alternate framing (selecting
amiChartinListingView) in a follow-up if you'd rather fix it that way; the issue's listed both options.