TL;DR
Payload CMS v3.6.0 introduces several key features including direct database access in migrations, improved job management, and better hydration control in Next.js. This release also fixes numerous UI issues, enhances rich text editor functionality, and improves bulk editing operations. The update focuses on developer experience with better TypeScript support and more consistent behavior across the platform.
Highlight of the Release
- Direct database access in migrations with
session and db parameters
- New job management features with
payload.jobs.runByID and where filtering
- Improved bulk editing that preserves unedited field values
- Sequential autosave to prevent race conditions
- Next.js 15.1.0 compatibility and hydration warning control
Migration Guide
Accessing Database in Migrations
If you were previously using workarounds to access the database in migrations, you can now use the officially supported approach:
MongoDB:
import { type MigrateUpArgs } from '@payloadcms/db-mongodb'
export async function up({ session, payload, req }: MigrateUpArgs): Promise<void> {
const posts = await payload.db.collections.posts.collection.find({ session }).toArray()
}
PostgreSQL:
import { type MigrateUpArgs, sql } from '@payloadcms/db-postgres'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
const { rows: posts } = await db.execute(sql`SELECT * from posts`)
}
SQLite:
import { type MigrateUpArgs, sql } from '@payloadcms/db-sqlite'
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
const { rows: posts } = await db.run(sql`SELECT * from posts`)
}
Next.js 15.1.0 Compatibility
If you're using Next.js 15.1.0, this release includes compatibility fixes. No action is required on your part.
Hydration Warnings
If you want to suppress hydration warnings in the admin UI, you can now add:
admin: {
suppressHydrationWarning: true
}
to your Payload config.
Upgrade Recommendations
This release includes several important bug fixes and new features that improve developer experience and admin UI functionality. It's recommended to upgrade to v3.6.0, especially if you:
- Work with database migrations and need direct database access
- Use job queues and need more control over job execution
- Experience issues with bulk editing in the admin UI
- Have encountered autosave race conditions
- Use Next.js 15.1.0 and experienced compatibility issues
The upgrade should be straightforward with minimal risk as there are no breaking changes reported. As always, test thoroughly in a development environment before deploying to production.
Bug Fixes
UI Improvements
- Fixed unwanted data overrides when bulk editing that could reset fields to default values
- Ensured admin.disableListFilter is properly respected despite URL search parameters
- Refreshed column state during HMR and respected admin.disableListColumn despite preferences
Rich Text Editor Fixes
- Fixed field errors and descriptions not being displayed in rich text editors
- Added missing lexical-html export to the lexical-proxy exports
Next.js Compatibility
- Fixed Next.js 15.1.0 compatibility by updating import paths
- Stopped automatic formatting of top-level domains within admin.preview or livePreview.url functions
- Added default ServerProps to Edit and List view action slots
Other Important Fixes
- Ensured autosave only runs sequentially to prevent race conditions
- Fixed forgotPassword expiration time setting
- Upgraded PostgreSQL snapshot during v3 upgrade if needed
- Fixed website template infinite reload bug with 404s in production mode
- Fixed error when passing server-only props in custom field components
New Features
Direct Database Access in Migrations
Now you can directly access the database with the active transaction in migrations using the newly exposed session (MongoDB) and db (PostgreSQL/SQLite) parameters in the up and down functions. This makes it easier to execute raw SQL or perform complex database operations within migrations.
Enhanced Job Management
Two new features improve job management capabilities:
payload.jobs.runByID: Run a specific job by its ID
payload.jobs.run with where filtering: Filter jobs to run based on criteria like { where: { 'input.message': { equals: 'secret' } } }
Next.js Hydration Warning Control
Added a new suppressHydrationWarning property to the payload config admin options, allowing developers to control whether React hydration warnings are displayed when server-rendered HTML intentionally differs from client-rendered DOM.
Consolidated Create and Duplicate Operations
The create and duplicate operations have been consolidated for better consistency and code reuse.
Security Updates
No significant security fixes were included in this release.
Performance Improvements
Sequential Autosave
The autosave system has been improved to use a queue-based approach that prevents multiple autosaves from running in parallel. This ensures that only the latest autosave is performed and prevents inconsistent results from parallel fetches.
Better Type Testing
Added types testing with tstyche to ensure type definitions don't break between updates, improving the reliability of TypeScript integrations.
Optimized Database Operations
The exposure of session and db in migrations allows for more optimized database operations by using the active transaction directly, reducing overhead and potential connection issues.
Impact Summary
Payload CMS v3.6.0 delivers significant improvements to developer experience and admin UI functionality. The ability to directly access databases in migrations with transaction support solves a long-standing pain point for developers working with complex data migrations. The enhanced job management features provide more granular control over background tasks.
For content editors, the fixes to bulk editing, autosave, and rich text editor components create a more reliable and consistent editing experience. The sequential autosave implementation prevents potential data inconsistencies that could occur with parallel saves.
System administrators will appreciate the Next.js 15.1.0 compatibility fixes and the ability to upgrade PostgreSQL snapshots during v3 migration.
Overall, this release represents a solid improvement to Payload's core functionality with no breaking changes, making it a recommended upgrade for all users.
Full Release Notes
v3.6.0 (2024-12-11)
๐ Features
- expose
session, db in migrations to use the active transaction with the database directly (#9849) (b73fc58)
- consolidates create and duplicate operations (#9866) (ca52a50)
- allow
where in payload.jobs.run (#9877) (b1ef28d)
- add payload.jobs.runByID (#9875) (09246a4)
- next: adds
suppressHydrationWarning property to payload config admin options (#9867) (5223990)
๐ Bug Fixes
- cannot pass function to client error when defining server-only props in custom field components (#9898) (91e8acc)
- ensures autosave only runs sequentially (#9892) (a0f0316)
- forgotPassword set expiration time (#9871) (306b5d2)
- upgrade pg snapshot during v3 upgrade if needed (#9837) (1e5364f)
- next: thread default ServerProps to view actions and other components that were missing (#9868) (0303b78)
- next: next.js 15.1.0 compatibility by not importing isRedirectError from next/dist (#9878) (5bfc92d)
- next: does not format top-level domains within admin.preview or livePreview.url functions (#9831) (e095222)
- richtext-*: field errors and descriptions were not displayed (#9824) (60ceeb0)
- richtext-lexical: lexical-html export (#9793) (d791db2)
- templates: website infinite reload bug with 404s in production mode (#9843) (d3b8d0c)
- ui: ensures admin.disableListFilter is disabled despite url search params (#9874) (da6bc55)
- ui: refreshes column state during hmr and respects admin.disableListColumn despite preferences (#9846) (f7172b5)
- ui: prevents unwanted data overrides when bulk editing (#9842) (563694d)
๐ Refactors
- richtext-lexical: export useBlockComponentContext and useInlineBlockComponentContext (#9896) (b83ea84)
- richtext-lexical: export JSXConverter type (#9815) (7599ede)
๐ Documentation
- properly capitalize SQLite and Next.js (#9848) (7642837)
- add missing types, prefer pnpm, fix various typos, discourage using payload from import (#9847) (254d888)
- fix typo (#9845) (36c2714)
๐งช Tests
- properly mock nodemailer verify in unit test (#9832) (e746d7a)
๐ Templates
- bump for v3.5.0 (#9844) (43a0ce7)
- website template added changes for seed script, relative live preview URLs and fixed endpoint status code (#9808) (b0c9b41)
- bump for v3.5.0 (#9804) (1fdc7cc)
โ๏ธ CI
- add missing tests to all-green dependency array (#9825) (84abfdf)
- add PR co-authors to contributors section of release notes (e236c28)
- add types testing with
tstyche (#9803) (f09ee0b)
- adjust tag detection for post-release-templates (67a35d3)
๐ก Chores
- better default for useAsTitle with custom auth collections (#9841) (fee1744)
- post-release-templates fetch tags (2c0bea8)
- update template lockfiles (a80de3f)
- deps: upgrade dataloader dependency from 2.2.2 to 2.2.3 (#9823) (dc741bb)
๐ค Contributors