Skip to content

Split each chapter's problems and quiz so the atlas loads only problems - #38

Merged
renrenmimi merged 1 commit into
mainfrom
perf/split-problems-and-quiz
Oct 8, 2026
Merged

renrenmimi merged 1 commit into
mainfrom
perf/split-problems-and-quiz

Conversation

@renrenmimi

Copy link
Copy Markdown
Owner

Summary

Audit item A#28.

The problem. Every lib/<ch>-data.tsx exported both PROBLEMS and QUIZ. Each chapter page uses both, so webpack kept both exports in the module it shares with /atlas. As a result, the atlas loaded the quiz text of 13 chapters that it never shows.

The change:

  • Each module is now split in two:
    • lib/<ch>-problems.tsx holds PROBLEMS, plus any constant that only the problems use (such as the array chapter's TAG);
    • lib/<ch>-quiz.tsx holds QUIZ.
  • The problems file keeps the git history through a rename. Its header now says where the quiz lives, and quiz-only remarks moved out of it.
  • The arrays themselves are byte-identical to before; a script compared every PROBLEMS and QUIZ array against main.
  • Chapter pages import both modules. app/atlas/page.tsx imports only the problem modules.
  • The file map in CLAUDE.md lists the new pair.

Measurements

next build, First Load JS:

Route main This branch
/atlas 297 kB 213 kB
Chapter pages 163–197 kB unchanged, or up to 2 kB smaller

Test plan

  • A script checked that each chapter's PROBLEMS and QUIZ source text equals the original.
  • npm run typecheck, npm test (103 passed), npm run build, npx playwright test (55 passed).

🤖 Generated with Claude Code

Every lib/<ch>-data.tsx exported both PROBLEMS and QUIZ. The chapter page
uses both, so webpack kept both in the module it shares with /atlas, and
the atlas loaded thirteen chapters' quiz text it never shows (A#28).

Each module is now two: lib/<ch>-problems.tsx (PROBLEMS, plus any constant
only the problems use) and lib/<ch>-quiz.tsx (QUIZ). The arrays themselves
are byte-identical to before. Chapter pages import both; app/atlas/page.tsx
imports only the problem modules. CLAUDE.md's file map lists the new pair.

/atlas First Load JS drops from 297 kB to 213 kB. Chapter pages are
unchanged or up to 2 kB smaller.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 8, 2026 23:49
@vercel

vercel Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
data-data Ready Ready Preview Oct 8, 2026 11:50pm UTC

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T23:51:09.894942Z 722bebf PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@renrenmimi
renrenmimi merged commit ed6d853 into main Oct 8, 2026
3 checks passed
@renrenmimi
renrenmimi deleted the perf/split-problems-and-quiz branch October 8, 2026 23:53

This branch was successfully deployed

1 active deployment
Preview — 722bebf7 Deployed Oct 8, 2026 by vercel[bot]
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.

2 participants