fix: guard paper grid view transitions#468
Draft
cursor[bot] wants to merge 1 commit into
Draft
Conversation
Co-authored-by: theg1239 <theg1239@users.noreply.github.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Bug and impact
Past-paper course pages render
CoursePaperGrid, which wrapped every paper card in React's experimental<ViewTransition>. In the current runtime (react@19.2.7),React.ViewTransitionis not exported, so rendering a course page with papers can passundefinedas a component and crash the page instead of showing the paper grid.Root cause
A previous fix guarded one ViewTransition usage, but
CoursePaperGridstill rendered the experimental component unconditionally.Fix
Added a small
PaperCardTransitionwrapper that renders<ViewTransition>only whentypeof ViewTransition === "function"; otherwise it renders children directly so the grid remains usable on runtimes without the experimental API.Validation
node -e "const React=require('react'); ..."confirmedreact 19.2.7,ViewTransition type undefined,has ViewTransition false../node_modules/.bin/tsx scripts/test-global-error-reload-guard.ts./node_modules/.bin/tsx scripts/test-pdf-download-page-edits.tsNotes:
corepack pnpm install --frozen-lockfile --prefer-offlineis currently blocked by the repo's pre-existing pnpm override/lockfile config mismatch. Directtsc --noEmitstill hits the repo's known standalone SVG/generated-data declaration failures unrelated to this change.spent a lot of water and tokens to review your slop
Greptile Summary
This PR guards the past-paper grid card transition so the page still renders without React’s experimental transition export. The main changes are:
PaperCardTransitionwrapper around each paper card.ViewTransitiononly when it is available as a function.Confidence Score: 5/5
Safe to merge with minimal risk.
The change is narrowly scoped to replacing an unconditional experimental React component render with a runtime type guard and transparent children fallback. No correctness or security issues were found in the changed path.
No files require special attention.
What T-Rex did
Important Files Changed
ViewTransitiononly when React exports it, otherwise rendering children directly.Sequence Diagram
%%{init: {'theme': 'neutral'}}%% sequenceDiagram participant Grid as CoursePaperGrid participant Wrapper as PaperCardTransition participant React as React.ViewTransition participant Card as CoursePaperCard Grid->>Wrapper: render paper card children Wrapper->>React: check typeof ViewTransition alt ViewTransition is a function Wrapper->>React: render transition with enter/exit/update props React->>Card: render card content else ViewTransition unavailable Wrapper->>Card: render children directly end%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%% sequenceDiagram participant Grid as CoursePaperGrid participant Wrapper as PaperCardTransition participant React as React.ViewTransition participant Card as CoursePaperCard Grid->>Wrapper: render paper card children Wrapper->>React: check typeof ViewTransition alt ViewTransition is a function Wrapper->>React: render transition with enter/exit/update props React->>Card: render card content else ViewTransition unavailable Wrapper->>Card: render children directly endReviews (1): Last reviewed commit: "fix: guard paper grid view transitions" | Re-trigger Greptile