Files
payload/test/fields/collections/Lexical/ModifyInlineBlockFeature/feature.server.ts
Alessio Gravili 4c96028e87 fix(richtext-lexical): allow external state mutation of block node from outside the form (#10486)
Previously, updates of the node fields from outside the form using
setFields did not trigger re-fetching the initial state, and thus
providing updated values to the form. This is to avoid unnecessary
re-renders of the form and unnecessary requests when setFields is
triggered from within the form.

This PR resets the initial state, thus triggering a re-render and
re-fetch of the initial state, if node.setFields is called from outside
the form. This preserves the performance optimization
2025-01-10 01:03:51 -07:00

10 lines
310 B
TypeScript

import { createServerFeature } from '@payloadcms/richtext-lexical'
export const ModifyInlineBlockFeature = createServerFeature({
key: 'ModifyInlineBlockFeature',
feature: {
ClientFeature:
'./collections/Lexical/ModifyInlineBlockFeature/feature.client.js#ModifyInlineBlockFeatureClient',
},
})