Skip to content

feat!: deprecates the component map - #7519

Merged
jacobsfletch merged 31 commits into
beta-nextfrom
feat/deprecate-comp-map
Aug 6, 2024
Merged

jacobsfletch merged 31 commits into
beta-nextfrom
feat/deprecate-comp-map

Conversation

@jacobsfletch

@jacobsfletch jacobsfletch commented Aug 5, 2024 •

Copy link
Copy Markdown
Member

Description

Deprecates the component map by merging its logic into the client config. The main goal of this change is for performance and simplification. There was no need to deeply iterate over the Payload config twice, once for the component map, and another for the client config. Instead, we can do everything in the client config one time. This has also dramatically simplified the client side prop drilling through the UI library. Now, all components can share the same client config which matches the exact shape of their Payload config (with the exception of non-serializable props and mapped custom components).

One other important change here is that we need to ensure the HTML isn't bloated when using deeply nested fields. We need to ensure that React maintains a single reference for props that are drilled and ensure that as few $undefined strings make their way into the client-side bundle as possible.

There are a few things left to do here still, which will come in separate PRs:

  1. Migrate rich text from component map to client config. Update: feat: working lexical and richtext-slate, fix types, misc stuff, fields test suite is booting up #7559 (and others)
  2. Fully passing tests. Most are already passing (with the exception of rich text related tests), but some fail to run due to the import map resolving to undefined on startup. CI will definitely fail because TS currently prevents build. Update: feat!: get beta-next to build, fix all types and errors #7594 (and others)
  3. Resolve the broken types. Inferring field types based on type property has been broken due to using Omit. Need to resolve this across the board. Update: feat: client field types #7546 (and others)

This is breaking change. The useComponentMap hook no longer exists, and most component props have changed (for the better):

const { componentMap } = useComponentMap() // old
const { config } = useConfig() // new

The useConfig hook has also changed in shape, config is now a property within the context obj:

const config = useConfig() // old
const { config } = useConfig() // new
  • I have read and understand the CONTRIBUTING.md document in this repository.

@jacobsfletch
jacobsfletch merged commit bb9667e into beta-next Aug 6, 2024
@jacobsfletch
jacobsfletch deleted the feat/deprecate-comp-map branch August 6, 2024 13:44
@AlessioGr AlessioGr mentioned this pull request Aug 13, 2024
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant