mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 04:43:20 +03:00
fix: convert sleep to raf
This commit is contained in:
parent
67f0a2516b
commit
3a4bc73d38
@ -4,7 +4,7 @@ import {
|
|||||||
PluginHooks,
|
PluginHooks,
|
||||||
Virgo,
|
Virgo,
|
||||||
} from '@toeverything/components/editor-core';
|
} from '@toeverything/components/editor-core';
|
||||||
import { Point, sleep } from '@toeverything/utils';
|
import { Point } from '@toeverything/utils';
|
||||||
import { GroupDirection } from '@toeverything/framework/virgo';
|
import { GroupDirection } from '@toeverything/framework/virgo';
|
||||||
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
||||||
import { DragItem } from './DragItem';
|
import { DragItem } from './DragItem';
|
||||||
@ -154,10 +154,11 @@ export const GroupMenu = function ({ editor, hooks }: GroupMenuProps) {
|
|||||||
setShowMenu(false);
|
setShowMenu(false);
|
||||||
|
|
||||||
if (groupBlock) {
|
if (groupBlock) {
|
||||||
const unobserve = groupBlock.onUpdate(async () => {
|
const unobserve = groupBlock.onUpdate(() => {
|
||||||
await sleep();
|
requestAnimationFrame(() => {
|
||||||
setGroupBlock(null);
|
setGroupBlock(null);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
return unobserve;
|
return unobserve;
|
||||||
}
|
}
|
||||||
return undefined;
|
return undefined;
|
||||||
|
Loading…
Reference in New Issue
Block a user