feat(richtext-lexical)!: lazy import React components to prevent client-only code from leaking into the server (#4290)

* chore(richtext-lexical): lazy import all React things

* chore(richtext-lexical): use useMemo for lazy-loaded React Components to prevent lag and flashes when parent component re-renders

* chore: make exportPointerFiles.ts script usable for other packages as well by hoisting it up to the workspace root and making it configurable

* chore(richtext-lexical): make sure no client-side code is imported by default from Features

* chore(richtext-lexical): remove unnecessary scss files

* chore(richtext-lexical): adjust package.json exports

* chore(richtext-*): lazy-import Field & Cell Components, move Client-only exports to /components subpath export

* chore(richtext-lexical): make sure nothing client-side is directly exported from the / subpath export anymore

* add missing imports

* chore: remove breaking changes for Slate

* LazyCellComponent & LazyFieldComponent
This commit is contained in:
Alessio Gravili
2023-12-06 14:20:18 +01:00
committed by GitHub
parent 80ef18c149
commit 5de347ffff
88 changed files with 849 additions and 413 deletions

View File

@@ -1,7 +1,7 @@
import joi from 'joi'
import { adminViewSchema } from './shared/adminViewSchema'
import { livePreviewSchema } from './shared/componentSchema'
import { componentSchema, livePreviewSchema } from './shared/componentSchema'
const component = joi.alternatives().try(joi.object().unknown(), joi.func())
@@ -94,8 +94,10 @@ export default joi.object({
.object()
.required()
.keys({
CellComponent: component.required(),
FieldComponent: component.required(),
CellComponent: componentSchema.optional(),
FieldComponent: componentSchema.optional(),
LazyCellComponent: joi.func().optional(),
LazyFieldComponent: joi.func().optional(),
afterReadPromise: joi.func().optional(),
outputSchema: joi.func().optional(),
populationPromise: joi.func().optional(),