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.

fix: convert sleep to raf

LuciNyan3a4bc73d386d
diff --git a/libs/components/editor-plugins/src/menu/group-menu/GropuMenu.tsx b/libs/components/editor-plugins/src/menu/group-menu/GropuMenu.tsx
index 118600aaa5..8ccf8b5e55 100644
--- a/libs/components/editor-plugins/src/menu/group-menu/GropuMenu.tsx
+++ b/libs/components/editor-plugins/src/menu/group-menu/GropuMenu.tsx
@@ -4,7 +4,7 @@ import {
PluginHooks,
Virgo,
} from '@toeverything/components/editor-core';
-import { Point, sleep } from '@toeverything/utils';
+import { Point } from '@toeverything/utils';
import { GroupDirection } from '@toeverything/framework/virgo';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { DragItem } from './DragItem';
@@ -154,9 +154,10 @@ export const GroupMenu = function ({ editor, hooks }: GroupMenuProps) {
setShowMenu(false);
if (groupBlock) {
- const unobserve = groupBlock.onUpdate(async () => {
- await sleep();
- setGroupBlock(null);
+ const unobserve = groupBlock.onUpdate(() => {
+ requestAnimationFrame(() => {
+ setGroupBlock(null);
+ });
});
return unobserve;
}