mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-11 15:16:28 +08:00
fix: convert sleep to raf
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user