migrating to cache components nextjs#114
Merged
Merged
Conversation
Replace setRequestLocale and client-side use(params) across many pages with server-side next-intl APIs (getLocale/getTranslations) and update the internationalization getRequestConfig to resolve locale from root params and return 404 for invalid locales Add DeferredAiSheetOpen and DeferredComments dynamic client components and minimal Loading placeholders. Rename not-found to global-not-found and add metadata. Move providers into app shell, enable cacheComponents, and add cacheLife imports. Bump next in internationalization package and update pnpm lock
Removed server-side setRequestLocale calls and related locale extraction (use(params)/getLocaleOrThrow) across many pages and layouts, simplifying next-intl imports to only what's needed. Moved the data-pagefind-body attribute into LayoutContent and removed the wrapper in AppShell. Provide a fallback VirtualContext in use-virtual to avoid undefined context and supply a stable virtualRef.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Add a Node script that builds a Pagefind index directly from MDX/content source (apps/www/scripts/pagefind.ts) and switch postbuild to run it. Remove data-pagefind-ignore attributes across pages and components so their content is included. Add remark + remark-mdx deps, fix MDX content types and rendering (call Content component, extract exercise Q/A), and remove stale "Enable static rendering" comments.
Delete /ask page, Ask CTA and results components, and the entire packages/seo/ask dataset and types. Remove ask-related imports from sitemap and indexing scripts.
Extract result-group components in the search UI. Add getPagefindSectionResults, hasPagefindExcerpt, and trimExcerptPrefix to normalize Pagefind sub-results, hide empty excerpt markup in the UI, and add tests for the new behavior.
Cover normalizePagefindResult cases: preserve empty HTML excerpts, keep excerpts unchanged when the title isn't repeated at the start, and trim repeated title prefixes that merge into a text token. Also add a test for getPagefindSectionResults returning an empty array when sub_results is empty.
Use Mantine's useDisclosure and useLayoutEffect to close or reset transient controls (dropdowns, drawers, collapsibles, audio, dialogs) when Next.js hides pages via Cache Components. Add explanatory comments and replace several useState usages. Remove MainShellBoundary which is no longer needed.
Rename and relocate many pages from (dynamic)/(static) into (main) and (site) route groups to simplify routing. Remove duplicate per-group layouts and add a single (app)/(main)/layout that renders AppShell to avoid shell-state divergence. Seed the Convex Better Auth token once at the shared (app) boundary (using ConvexAppProviders and Suspense) so static and dynamic routes coexist with correct SSR and hydration.
Introduce AppProviders and SharedProviders and mount them at the appropriate layout boundaries. Move request-scoped Convex/user seeding into AppProviders and scope search/Pagefind/AI/content-view providers into SharedProviders. Remove the old providers index and ConvexAppProviders, move try-out routes into the shared group, and update affected layouts, imports, and the app shell to use the new boundaries.
Remove server-side async inequality functions and the imports from the MDX files; use static boundaryLine2D values instead. Add useLayoutEffect and canvasKey state in CoordinateSystem to force remount of the ThreeCanvas when the visualization is hidden, preventing stale WebGL scenes and resetting play/drag state.
Add importContentModule for canonical localized MDX dynamic imports and use it from the scoped content loader. Simplify getScopedContent calls and update callers and tests to match the new importer signature. Refactor exercise/article components to accept pre-imported question/ answer nodes and adjust page logic accordingly. Apply minor design-system cleanups (docblocks, remove unnecessary "use client", scroll area types).
Implement loaders that read exercise question/answer metadata and choices without importing compiled MDX, including a GitHub raw fallback for missing choices. Export cache-wrapped helpers for page usage and add comprehensive unit tests covering success paths and edge cases.
Introduce getScopedPathTarget for root-only path validation and make getScopedContentTarget compose over it to add locale-specific MDX path. Update getScopedReferences to use the path-only target (ref modules are locale-agnostic) and adjust tests to mock the importer and assert it is called with the root-relative directory path.
Replace the monolithic packages/contents/_lib/exercises.ts with four new modules: collection, renderable, set, and source. Update import sites across apps to use the new paths and adjust references to getExerciseCount, getExercisesContent, getExerciseByNumber, and related helpers. Remove the ChoicesValidationError from shared errors.
Replace the old @takumi-rs/image-response usage with takumi-js/response and update serverExternalPackages to include @takumi-rs/core. Remove the deprecated dependency, add takumi-js, and bump pagefind to 1.5.2. Update pnpm lockfile to match. Add a brief JSDoc for the OgImage renderer.
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.
Uh oh!
There was an error while loading. Please reload this page.