refactor: improve block modularity on server (#758)

This commit is contained in:
Jeremy 2025-02-04 17:15:39 +03:00 committed by GitHub
parent 711da0b94b
commit 9c4dbc8aaa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 419 additions and 259 deletions

View file

@ -91,6 +91,7 @@ export const BlockActions = memo(PureBlockActions, (prevProps, nextProps) => {
if (prevProps.currentVersionIndex !== nextProps.currentVersionIndex)
return false;
if (prevProps.isCurrentVersion !== nextProps.isCurrentVersion) return false;
if (prevProps.block.content !== nextProps.block.content) return false;
return true;
});

View file

@ -26,11 +26,11 @@ import { BlockCloseButton } from './block-close-button';
import { BlockMessages } from './block-messages';
import { useSidebar } from './ui/sidebar';
import { useBlock } from '@/hooks/use-block';
import { textBlock } from '@/blocks/text';
import { imageBlock } from '@/blocks/image';
import { codeBlock } from '@/blocks/code';
import { imageBlock } from '@/blocks/image/client';
import { codeBlock } from '@/blocks/code/client';
import { sheetBlock } from '@/blocks/sheet/client';
import { textBlock } from '@/blocks/text/client';
import equal from 'fast-deep-equal';
import { sheetBlock } from '@/blocks/sheet';
export const blockDefinitions = [textBlock, codeBlock, imageBlock, sheetBlock];
export type BlockKind = (typeof blockDefinitions)[number]['kind'];