Skip to content

perf(uxcg): stop shipping unused data on UXCG pages - #254

Merged
manager merged 2 commits into
mainfrom
release/uxcg-slim
Oct 15, 2026
Merged

manager merged 2 commits into
mainfrom
release/uxcg-slim

Conversation

@manager

@manager manager commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

UXCG pages were the heaviest pages on the site: 3.1 MB of page data per question page and 1.7 MB on the list. With ISR rendering them on demand, a burst of requests exhausted the frontend heap.

  • Question page: drop questionsTest and questions (never read by the page), send biases for the current locale only.
  • List page: drop biases (never read by the page).
  • Both: other locales' questions keep only number and aliases, the fields cross-language search reads. The current locale stays complete for the table, the modal and prev/next.

Measured by applying the same trim to the live payloads: question page 3.14 MB -> 0.74 MB, list 1.73 MB -> 0.33 MB. tsc --noEmit clean.

Authorized by Wolf on 2026-10-15.

🤖 Generated with Claude Code

The question page carried every locale's questions three times and every
locale's biases (3.1 MB of page data); the list page carried all biases
it never renders (1.7 MB). Drop the unused props, send biases for the
current locale only, and slim the other locales' questions to the fields
search reads. Measured on the live payloads: 3.14 MB -> 0.74 MB and
1.73 MB -> 0.33 MB.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Claude finished @manager's task in 27s —— View job


Review of #254 (perf(uxcg): stop shipping unused data)

Verdict: The change looks correct. I have one style nit.

What I checked

  • Search: filterQuestionsBySearchTerm in UXCGLayout.tsx reads only attributes.aliases and attributes.number from other locales. The slimmed shape keeps both, so cross-language search still works. The current locale stays complete for the table, modal and prev/next.
  • Question page: the questions and questionsTest props are not read anywhere. questions is destructured but unused, and the layout and modal get allQuestions[locale]. Sending biases for the current locale only matches biases?.[locale] at line 185.
  • List page: biases is not referenced in index.tsx, so dropping it and the getStrapiBiases fetch is safe.
  • UX Core data: no bias data, slugs or schema are changed. Only what is serialized into page props changes.
  • I did not run tsc, lint or the app. This is a read-through only.

Notes

  • Import order (inline comment): src/pages/uxcg/index.tsx has its whole import block reshuffled. Please restore the original grouping and make only the minimal edits.
  • Optional hardening: biases[locale] would be undefined if locale were ever outside en/ru/hy. Next.js rejects undefined in props. The locale set is fixed, so this is low risk. ?? [] would make it safe.
  • Optional typing: slimUXCGQuestions takes any[]. A QuestionType-based type would be a small improvement.

Per CLAUDE.md, this should not merge to main without Wolf's direct go in the conversation. The PR body says Wolf authorized it on 2026-10-15.

Comment thread src/pages/uxcg/index.tsx
} from '@uxcore/lib/helpers';

import { getStrapiBiases } from '@uxcore/api/biases';
import { getUXCGSeo } from '@uxcore/api/mainPageSeo';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This hunk rewrites the whole import block into one alphabetical list. It drops the grouped, blank-line-separated order that AGENTS.md describes, and it makes a perf PR's diff noisier. Please restore the original grouping and only add slimUXCGQuestions and remove the unused getStrapiBiases and mergeBiasesLocalization imports.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Tried restoring the grouped order: the file as it is on main already fails simple-import-sort/imports ("Run autofix to sort these imports!"), and the pre-commit hook runs eslint --fix, so any commit touching this file re-sorts the block. The sorted order is what the repo's lint config produces; keeping it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@manager

manager commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

Applied the ?? [] fallback for biases. Import order: see the inline reply, the lint hook enforces the sorted block. Typing of slimUXCGQuestions left as is, it matches the untyped Strapi payload the page already handles.

@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Claude finished @manager's task in 17s —— View job


Review of #254 (perf(uxcg): stop shipping unused data)

Verdict: The logic is sound. One change is needed before merge: the import-order churn in src/pages/uxcg/index.tsx.

Checked

  • slimUXCGQuestions keeps the full current-locale list and reduces other locales to number and aliases. That is what cross-language search reads.
  • [slug].tsx: dropping questionsTest and questions is safe, since sortedQuestions is still used for questionsLength. The ?? [] fallback for an unknown locale from the latest commit (995203d) is in place.
  • index.tsx: dropping biases and the getStrapiBiases fetch also removes a build-time Strapi call.
  • No bias data, slugs or schema are touched, only what gets serialized into page props.
  • I read the diff only. I did not run tsc, lint or the app.

To fix

  • Import order (inline comment on src/pages/uxcg/index.tsx:1): the whole import block is reshuffled into one flat list. Restore the original grouping and make only the three import edits.

Optional

  • slimUXCGQuestions takes any[]. A QuestionType-based type would be a small improvement.

Merge gate: per CLAUDE.md, merging to main needs Wolf's direct go in the conversation. The PR body cites an authorization dated 2026-10-15.

Comment thread src/pages/uxcg/index.tsx
} from '@uxcore/lib/helpers';

import { getStrapiBiases } from '@uxcore/api/biases';
import { getUXCGSeo } from '@uxcore/api/mainPageSeo';

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The whole import block is re-sorted into one flat list: the blank-line groups are gone and next/react moved from the top to the bottom. That has nothing to do with this perf change and breaks the grouped order the sibling pages use (see [slug].tsx). Please restore the original block and make only three edits: add slimUXCGQuestions, drop mergeBiasesLocalization, drop getStrapiBiases.

@manager
manager merged commit a1023da into main Oct 15, 2026
4 checks passed
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