feat: pre-compile ui and richtext-lexical with react compiler (#7688)

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
This commit is contained in:
Alessio Gravili
2024-08-19 17:31:36 -04:00
committed by GitHub
parent adf2f31178
commit ebd43c7763
182 changed files with 897 additions and 587 deletions

View File

@@ -59,21 +59,24 @@
"@sentry/react": "^7.77.0",
"@types/react": "npm:types-react@19.0.0-rc.0",
"@types/react-dom": "npm:types-react-dom@19.0.0-rc.0",
"babel-plugin-react-compiler": "0.0.0-experimental-592953e-20240517",
"babel-plugin-react-compiler": "0.0.0-experimental-1cd8995-20240814",
"comment-json": "^4.2.3",
"create-payload-app": "workspace:*",
"dotenv": "16.4.5",
"drizzle-kit": "0.23.2-df9e596",
"eslint-plugin-playwright": "1.6.2",
"execa": "5.1.1",
"file-type": "17.1.6",
"http-status": "1.6.2",
"jwt-decode": "4.0.0",
"lexical": "0.17.0",
"next": "15.0.0-canary.104",
"payload": "workspace:*",
"qs-esm": "7.0.2",
"react": "19.0.0-rc-06d0b89e-20240801",
"react-dom": "19.0.0-rc-06d0b89e-20240801",
"server-only": "^0.0.1",
"slate": "0.91.4",
"drizzle-kit": "0.23.2-df9e596",
"tempy": "^1.0.1",
"ts-essentials": "7.0.3",
"typescript": "5.5.4",