Skip to content

Commit

Permalink
fix(richtext-lexical): error when changing block collapsed state in r…
Browse files Browse the repository at this point in the history
…are cases (#9421)
  • Loading branch information
AlessioGr authored Nov 22, 2024
1 parent a891e98 commit b9cc4d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export const BlockComponent: React.FC<Props> = (props) => {
(changedCollapsed: boolean) => {
void getDocPreferences().then((currentDocPreferences) => {
const currentFieldPreferences =
currentDocPreferences?.fields[parentLexicalRichTextField.name]
currentDocPreferences?.fields?.[parentLexicalRichTextField.name]

const collapsedArray = currentFieldPreferences?.collapsed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export async function buildInitialState({
initialState[id].formState = formStateResult

if (node.type === 'block') {
const currentFieldPreferences = context.preferences?.fields[context.field.name]
const currentFieldPreferences = context.preferences?.fields?.[context.field.name]
const collapsedArray = currentFieldPreferences?.collapsed
if (collapsedArray && collapsedArray.includes(id)) {
initialState[id].collapsed = true
Expand Down

0 comments on commit b9cc4d4

Please sign in to comment.