Skip to content

fix: guard paper grid view transitions#468

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-b4a6
Draft

fix: guard paper grid view transitions#468
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-investigation-b4a6

Conversation

@cursor

@cursor cursor Bot commented Jul 15, 2026

Copy link
Copy Markdown

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.ViewTransition is not exported, so rendering a course page with papers can pass undefined as a component and crash the page instead of showing the paper grid.

Root cause

A previous fix guarded one ViewTransition usage, but CoursePaperGrid still rendered the experimental component unconditionally.

Fix

Added a small PaperCardTransition wrapper that renders <ViewTransition> only when typeof 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'); ..." confirmed react 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.ts

Notes: corepack pnpm install --frozen-lockfile --prefer-offline is currently blocked by the repo's pre-existing pnpm override/lockfile config mismatch. Direct tsc --noEmit still hits the repo's known standalone SVG/generated-data declaration failures unrelated to this change.

Open in Web View Automation 

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:

  • Adds a PaperCardTransition wrapper around each paper card.
  • Uses ViewTransition only when it is available as a function.
  • Falls back to rendering card children directly when the API is unavailable.

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.

T-Rex T-Rex Logs

What T-Rex did

  • The first offline link attempt was aborted due to pnpm's non-TTY modules purge confirmation.
  • The CI retry rebuilt node_modules but failed with ERR_PNPM_NO_OFFLINE_META while resolving @capacitor/cli from the package mirror.
  • The React viewtransition check failed because node_modules/react/package.json was missing, causing MODULE_NOT_FOUND when requiring react.
  • The explicit tsx validations could not run because the ./node_modules/.bin/tsx binary was absent.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
app/components/past_papers/course-paper-grid.tsx Adds a guarded wrapper so paper cards use ViewTransition only 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
Loading
%%{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
end
Loading

Reviews (1): Last reviewed commit: "fix: guard paper grid view transitions" | Re-trigger Greptile

Co-authored-by: theg1239 <theg1239@users.noreply.github.com>
@vercel

vercel Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
examcooker-dev Error Error Jul 15, 2026 11:03am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant