Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

chore: clean code

lawvs0c09bd2b8c1f
diff --git a/libs/components/editor-core/src/render-block/RenderBlock.tsx b/libs/components/editor-core/src/render-block/RenderBlock.tsx
index a7ebc1e2e1..0627aba95b 100644
--- a/libs/components/editor-core/src/render-block/RenderBlock.tsx
+++ b/libs/components/editor-core/src/render-block/RenderBlock.tsx
@@ -25,11 +25,11 @@ export function RenderBlock({
[block]
);
- const blockView = useMemo(() => {
+ const BlockView = useMemo(() => {
if (block?.type) {
- return editor.getView(block.type);
+ return editor.getView(block.type).View;
}
- return null;
+ return () => null;
}, [editor, block?.type]);
if (!block) {
@@ -44,22 +44,22 @@ export function RenderBlock({
columns: block.columns ?? [],
};
- const view = blockView?.View ? (
- <blockView.View
+ const view = (
+ <BlockView
editor={editor}
block={block}
columns={columns.columns}
columnsFromId={columns.fromId}
editorElement={editorElement}
/>
- ) : null;
+ );
return hasContainer ? (
<BlockContainer block-id={blockId} ref={setRef} data-block-id={blockId}>
{view}
</BlockContainer>
) : (
- <> {view}</>
+ view
);
}