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.

fixed: when remove all tag, editor will throw error in tag history popover, fixed #20

QiShaoXuan7dc25bfa9553
diff --git a/libs/components/editor-core/src/block-pendant/pendant-history-panel/PendantHistoryPanel.tsx b/libs/components/editor-core/src/block-pendant/pendant-history-panel/PendantHistoryPanel.tsx
index ce47f80e27..5fdd24788c 100644
--- a/libs/components/editor-core/src/block-pendant/pendant-history-panel/PendantHistoryPanel.tsx
+++ b/libs/components/editor-core/src/block-pendant/pendant-history-panel/PendantHistoryPanel.tsx
@@ -26,7 +26,6 @@ export const PendantHistoryPanel = ({
const { getProperties } = useRecastBlockMeta();
const { getProperty } = useRecastBlockMeta();
- const { getAllValue } = getRecastItemValue(block);
const recastBlock = useRecastBlock();
const [history, setHistory] = useState<RecastBlockValue[]>([]);
@@ -34,7 +33,7 @@ export const PendantHistoryPanel = ({
useEffect(() => {
const init = async () => {
- const currentBlockValues = getAllValue();
+ const currentBlockValues = getRecastItemValue(block).getAllValue();
const allProperties = getProperties();
const missProperties = allProperties.filter(
property => !currentBlockValues.find(v => v.id === property.id)
@@ -52,24 +51,26 @@ export const PendantHistoryPanel = ({
return history;
}, {});
- const blockHistory = await Promise.all(
- Object.entries(historyMap).map(
- async ([propertyId, blockId]) => {
- const latestValueBlock = (
- await groupBlock.children()
- ).find((block: AsyncBlock) => block.id === blockId);
+ const blockHistory = (
+ await Promise.all(
+ Object.entries(historyMap).map(
+ async ([propertyId, blockId]) => {
+ const latestValueBlock = (
+ await groupBlock.children()
+ ).find((block: AsyncBlock) => block.id === blockId);
- return getRecastItemValue(latestValueBlock).getValue(
- propertyId as RecastPropertyId
- );
- }
+ return getRecastItemValue(
+ latestValueBlock
+ ).getValue(propertyId as RecastPropertyId);
+ }
+ )
)
- );
-
+ ).filter(v => v);
setHistory(blockHistory);
};
+
init();
- }, [getAllValue, getProperties, groupBlock, recastBlock]);
+ }, [block, getProperties, groupBlock, recastBlock]);
return (
<StyledPendantHistoryPanel>