This noticeably improves performance in the admin panel, for example
when there are multiple richtext editors on one page (& likely
performance in other areas too, though I mainly tested rich text).
The babel plugin currently only optimizes files with a 'use client'
directive at the top - thus we have to make sure to add use client
wherever possible, even if it's imported by a parent client component.
There's one single component that broke when it was compiled using the
React compiler (it stopped being reactive and failed one of our admin
e2e tests):
150808f608
opting out of it completely fixed that issue
Fixes https://github.com/payloadcms/payload/issues/7366
62 lines
1.7 KiB
JavaScript
62 lines
1.7 KiB
JavaScript
export const allDatabaseAdapters = {
|
|
mongodb: `
|
|
import { mongooseAdapter } from '@payloadcms/db-mongodb'
|
|
|
|
export const databaseAdapter = mongooseAdapter({
|
|
url:
|
|
process.env.MONGODB_MEMORY_SERVER_URI ||
|
|
process.env.DATABASE_URI ||
|
|
'mongodb://127.0.0.1/payloadtests',
|
|
collation: {
|
|
strength: 1,
|
|
},
|
|
})`,
|
|
postgres: `
|
|
import { postgresAdapter } from '@payloadcms/db-postgres'
|
|
|
|
export const databaseAdapter = postgresAdapter({
|
|
pool: {
|
|
connectionString: process.env.POSTGRES_URL || 'postgres://127.0.0.1:5432/payloadtests',
|
|
},
|
|
})`,
|
|
'postgres-custom-schema': `
|
|
import { postgresAdapter } from '@payloadcms/db-postgres'
|
|
|
|
export const databaseAdapter = postgresAdapter({
|
|
pool: {
|
|
connectionString: process.env.POSTGRES_URL || 'postgres://127.0.0.1:5432/payloadtests',
|
|
},
|
|
schemaName: 'custom',
|
|
})`,
|
|
'postgres-uuid': `
|
|
import { postgresAdapter } from '@payloadcms/db-postgres'
|
|
|
|
export const databaseAdapter = postgresAdapter({
|
|
idType: 'uuid',
|
|
pool: {
|
|
connectionString: process.env.POSTGRES_URL || 'postgres://127.0.0.1:5432/payloadtests',
|
|
},
|
|
})`,
|
|
sqlite: `
|
|
import { sqliteAdapter } from '@payloadcms/db-sqlite'
|
|
|
|
export const databaseAdapter = sqliteAdapter({
|
|
client: {
|
|
url: process.env.SQLITE_URL || 'file:./payloadtests.db',
|
|
},
|
|
})`,
|
|
supabase: `
|
|
import { postgresAdapter } from '@payloadcms/db-postgres'
|
|
|
|
export const databaseAdapter = postgresAdapter({
|
|
pool: {
|
|
connectionString:
|
|
process.env.POSTGRES_URL || 'postgresql://postgres:postgres@127.0.0.1:54322/postgres',
|
|
},
|
|
})`,
|
|
}
|
|
|
|
export function getDatabaseAdapter(dbAdapter) {
|
|
return allDatabaseAdapters[dbAdapter]
|
|
}
|