Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
zurfyx committed May 27, 2024
1 parent 50c168b commit beff622
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import {
LexicalNode,
SerializedElementNode,
} from 'lexical';
import invariant from 'shared/invariant';

import {CollapsibleContainerNode} from './CollapsibleContainerNode';
import {$isCollapsibleContainerNode} from './CollapsibleContainerNode';

type SerializedCollapsibleContentNode = SerializedElementNode;

Expand All @@ -43,7 +44,11 @@ export class CollapsibleContentNode extends ElementNode {
const dom = document.createElement('div');
dom.classList.add('Collapsible__content');
editor.getEditorState().read(() => {
const containerNode = this.getParentOrThrow<CollapsibleContainerNode>();
const containerNode = this.getParentOrThrow();
invariant(
$isCollapsibleContainerNode(containerNode),
'Expected parent node to be a CollapsibleContainerNode',
);
if (!containerNode.__open) {
dom.style.display = 'none';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export class CollapsibleTitleNode extends ElementNode {
const collapsibleContainer = this.getLatest().getParentOrThrow();
invariant(
$isCollapsibleContainerNode(collapsibleContainer),
'something',
'Expected parent node to be a CollapsibleContainerNode',
);
collapsibleContainer.toggleOpen();
});
Expand Down

0 comments on commit beff622

Please sign in to comment.