Skip to content

Improve rendering performance #644

Open
@chrisvxd

Description

Rendering performance can sometimes be slow, with re-renders occurring whenever the app context changes in all components that depend on it.

This is particularly notable when changing field values, which makes multiple changes to the app context (due to advanced features like field resolution, data resolution, etc). This is somewhat masked by a 50ms debounce. This works, but is inconsistent and causes a delay between user input and rendered output. 50ms may also be insufficient for some environments, and shows a significant different between dev and prod environments.

We should improve rendering performance and eliminate the use of debounce entirely.

Proposals

Better memoizing

Review current memoization and improve it wherever possible.

Split contexts

Break context down into smaller chunks.

Use use-context-selector

Make use of the use-context-selector library, which implements RFC119.

Replace app context with another state solution

Various state management libraries use selectors to avoid unnecessary re-renders.

Virtualize components

Virtualize component rendering when out of view.

Considerations

  • Impact on usePuck hook
  • New drag-and-drop engine #556 will change how items are rendered
  • Stress testing #549
  • DropZone component relies on context to know structure of tree, causing entire tree re-renders when any item in the tree changes. Would be solved by dropzone/slot field.

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions