feat!: admin router adapter#16763
Merged
Merged
Conversation
Contributor
📦 esbuild Bundle Analysis for payloadThis analysis was generated by esbuild-bundle-analyzer. 🤖
Largest pathsThese visualization shows top 20 largest paths in the bundle.Meta file: packages/next/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_index.json, Out file: esbuild/index.js
Meta file: packages/payload/meta_shared.json, Out file: esbuild/exports/shared.js
Meta file: packages/richtext-lexical/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_client.json, Out file: esbuild/exports/client_optimized/index.js
Meta file: packages/ui/meta_shared.json, Out file: esbuild/exports/shared_optimized/index.js
DetailsNext to the size is how much the size has increased or decreased compared with the base branch of this PR.
|
Groups framework adapter implementations under packages/next/src/adapters/ instead of mixing them into elements/ (UI primitives) and utilities/ (misc helpers). The Next adapter is neither — it bridges next/navigation into the RouterAdapterContext contract from payload core. Sets up the structure for the upcoming ServerAdapter to live alongside as adapters/server.ts.
Separates router contracts from cookie contracts: - adapters/router.ts: RouterAdapterComponent, RouterAdapterRouter, LinkAdapterProps - adapters/cookies.ts: CookieStore, CookieOptions - adapters/index.ts: barrel re-export Makes room for ServerAdapter to land as adapters/server.ts on its own branch without re-mingling concerns in a single file.
r1tsuu
approved these changes
May 28, 2026
jacobsfletch
added a commit
that referenced
this pull request
May 29, 2026
Requires #16763 and #16753. Moves all elements and templates defined in the `@payloadcms/next` package to `@payloadcms/ui`. This is in effort to convert the `@payloadcms/next` package into a framework adapter. **Relocated exports** — code physically moved from `@payloadcms/next` to `@payloadcms/ui`: | Component | Old source | New source | | -------------------------- | ----------------------------- | ---------------------- | | `DefaultTemplate` | `@payloadcms/next/templates` | `@payloadcms/ui/rsc` | | `DefaultTemplateProps` | `@payloadcms/next/templates` | `@payloadcms/ui/rsc` | | `MinimalTemplate` | `@payloadcms/next/templates` | `@payloadcms/ui/rsc` | | `MinimalTemplateProps` | `@payloadcms/next/templates` | `@payloadcms/ui/rsc` | | `DocumentHeader` | `@payloadcms/next/rsc` | `@payloadcms/ui/rsc` | | `DefaultNav` | `@payloadcms/next/rsc` | `@payloadcms/ui/rsc` | | `Logo` | `@payloadcms/next/rsc` | `@payloadcms/ui/rsc` | | `HierarchyTypeFieldServer` | `@payloadcms/next/rsc` | `@payloadcms/ui/rsc` | | `DefaultNavClient` | `@payloadcms/next/client` | `@payloadcms/ui` | | `HierarchyTypeField` | `@payloadcms/next/client` | `@payloadcms/ui` | | `NavSidebarToggle` | `@payloadcms/next/client` | `@payloadcms/ui` | | `NavWrapper` | `@payloadcms/next/client` | `@payloadcms/ui` | This PR also removes the now unneeded export aliases. These were in place for backwards compatibility during v3. Now, we enforce that all imports point to its canonical source, not the aliased export. | Component | Old source | New source | | -------------------------- | ------------------------- | --------------------- | | `CollectionCards` | `@payloadcms/next/rsc` | `@payloadcms/ui/rsc` | | `SlugField` | `@payloadcms/next/client` | `@payloadcms/ui` | | `QueryPresetsAccessCell` | `@payloadcms/next/client` | `@payloadcms/ui` | | `QueryPresetsColumnField` | `@payloadcms/next/client` | `@payloadcms/ui` | | `QueryPresetsColumnsCell` | `@payloadcms/next/client` | `@payloadcms/ui` | | `QueryPresetsGroupByCell` | `@payloadcms/next/client` | `@payloadcms/ui` | | `QueryPresetsGroupByField` | `@payloadcms/next/client` | `@payloadcms/ui` | | `QueryPresetsWhereCell` | `@payloadcms/next/client` | `@payloadcms/ui` | | `QueryPresetsWhereField` | `@payloadcms/next/client` | `@payloadcms/ui` | The `./client`, `./rsc`, and `./templates` subpath exports on `@payloadcms/next` are removed entirely. #### Codemod To migrate automatically, there's a codemod for this change available by running: ```bash npx @payloadcms/codemod --transform migrate-next-subpath-exports ```
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.
The
@payloadcms/uipackage no longer depends onnextdirectly.This PR establishes a pattern to replace the admin panel's router with your own. This way you can power the admin panel with alternative React frameworks than Next.js, e.g. TanStack.
A few key takeaways:
Removes the
nextpackage frompeerDependencieswithin the@payloadcms/uipackage. Does so by providing a new router adapter context that allow for the entire routing layer to be swapped out (see next bullet).Creates a new
RouterAdaptercomponent that abstracts away allnext/navigationusages within the@payloadcms/uipackage. All frameworks will need to supply their own router's methods to the adapter.Here's what the
@payloadcms/nextadapter might look like (simplified):All router methods are now standardized behind shared hooks that can be used within any framework:
Removes all deprecated
Linkprops:import { Button } from '@payloadcms/ui' - import NextLink from 'next/link' export const MyButton = () => { return ( <Button - Link={NextLink} > Click Me </Button> ) }The
Linkcomponent introduced in feat: route transitions #9275 is already router agnostic. Payload has long standardized around this component, which eliminates any need to import fromnext/linkdirectly: