Fix blank error screen for unrecognized deck aspect ratios#2360
Conversation
This comment has been minimized.
This comment has been minimized.
|
Here's a visual recap of what changed: Open the full interactive recap |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…817488067b3c41ac805f
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Builder reviewed your changes — looks good ✅
Review Details
Incremental Code Review Summary
The updated PR addresses the previous review finding correctly. getAspectRatioDims now checks that a ratio is an own property of ASPECT_RATIOS, so malformed legacy values such as toString, constructor, and hasOwnProperty safely fall back to 16:9 rather than returning inherited functions. The added regression tests cover those keys along with unknown and empty values, while the shared Zod enum continues to constrain new patch-deck writes.
Two independent incremental reviews found no new reportable bugs; one noted only a low-severity cleanup opportunity in an unmodified PDF export caller (an outdated comment/dead nullish fallback), which is not actionable in this PR and is below the review threshold. One reviewer also reported that the full focused suite passed: 68 files and 353 tests, with formatting passing.
Risk remains standard because this changes shared rendering/export behavior and an action validation boundary. The previously reported inherited-key issue has been fixed and its review thread was resolved.
🧪 Browser testing: Will run after this review (PR touches UI code)

Summary
Fixes a crash that produced a blank error screen when opening or refining a deck with an unrecognized aspect ratio.
Problem
When a deck had an aspect ratio value that wasn't one of the recognized presets,
getAspectRatioDimswould returnundefined, which caused the app to crash with a blank error screen instead of rendering the deck.Solution
Made
getAspectRatioDimsresilient to unknown or invalid aspect ratio values by falling back to the default (16:9) instead of returningundefined. Also tightened thepatch-deckaction's validation so aspect ratio values are constrained to the known set at the API boundary.Key Changes
getAspectRatioDimsnow falls back toASPECT_RATIOS["16:9"]for any falsy or unrecognized aspect ratio input, rather than returningundefined.patch-deck.tsnow validatesaspectRatioagainstASPECT_RATIO_VALUESusing a Zod enum instead of a plain string, preventing invalid values from being persisted.aspect-ratios.test.tsto reflect the new fallback behavior for bogus and empty string values.To clone this PR locally use the Github CLI with command
gh pr checkout 2360You can tag me at @BuilderIO for anything you want me to fix or change