Refresh home and about pages with editorial layout#27
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e8740b54f1
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
src/shared/ui/pretext-statement.tsx
Outdated
| const lineHeight = parseLineHeight(computed.lineHeight, fontSize); | ||
| const targetLines = maxWidth < 560 ? 4 : 3; | ||
|
|
||
| setLocale(locale); |
There was a problem hiding this comment.
Move setLocale out of per-resize layout recomputation
setLocale(locale) is executed inside syncLayout, which runs on mount and on every ResizeObserver callback. In Pretext, changing locale clears internal caches, so this call forces cache invalidation on each resize and makes all subsequent measurements more expensive than necessary (including for other PretextStatement instances). Set the locale only when locale actually changes, not on every layout pass.
Useful? React with 👍 / 👎.
src/shared/ui/pretext-statement.tsx
Outdated
|
|
||
| while (low <= high) { | ||
| const mid = Math.floor((low + high) / 2); | ||
| const { lineCount, prepared } = measureLineCount(text, font, mid); |
There was a problem hiding this comment.
Reuse prepared segments during width search
The binary search repeatedly calls measureLineCount(...), and that helper rebuilds prepareWithSegments(text, font) each time even though text and font are constant for the whole pass. This defeats Pretext’s intended prepare-once/layout-many usage and turns resize/layout updates into repeated preprocessing work, which can cause avoidable jank on lower-end devices. Prepare once per syncLayout call and reuse that prepared object for all width probes.
Useful? React with 👍 / 👎.
Refresh home and about pages with editorial layout
Summary
PretextStatementcomponent, and add the about-page Playwright coveragePretextStatementagainst lossy line splitting so localized headings fall back to plain text when neededAGENTS.mdValidation
pnpm lintpnpm exec tsc --noEmitpnpm exec playwright test tests/about.spec.ts --project="Desktop Chrome"on port3101