I have an issue with a custom block type in the lexical editor. The block type contains richText fields that are just not present in the result returned from the API. Concretely, I have a cards module that has three rich text fields. Other fields of the card however are present in the response. Please look at the attached images of the post and the API response.
If you need the code, I already threw away a lot of what we had in the repo so that it is very close to a minimal sample. We have payload version 2.13.0 and @payloadcms/richtext-lexical version 0.10.0 in our package.json.
@Alessio🍣 could you take a look at this one when you have a minute?
@EricHier you will have to remove
localized: true
from any block fields / sub fields within lexical blocks. Having that property set will make them vanish from the API response.
This was a bug and has been fixed in the latest 3.0 beta version (
https://github.com/payloadcms/payload/pull/6489). If those same blocks/fields are shared & used in other places within payload, and you cannot remove localized: true, I recommend making a utility function which automatically strips
localized: true
from those fields
Thank you for your answer, @Alessio🍣 !
This means in cases where I use the blocks only in a localized richText field, I can just omit the localized field and everything will work as expected? And the localisation will still work as the base richText field is localized, right?
in cases where I use the blocks only in a localized richText field, I can just omit the localized field and everything will work as expected?
Exactly! Omit it from any field & sub-field
And the localisation will still work as the base richText field is localized, right?
Yep! If any parent is localized, in this case the richText field, the localization property of sub fields will not have any effect anyways (outside of this lexical bug where it breaks)
Thank you so much! :) I'll give that a try
Star
Discord
online
Get help straight from the Payload team with an Enterprise License.