mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Fix performance bug (#984)
This commit is contained in:
parent
f4cc4253b8
commit
e9f5175f51
3 changed files with 121 additions and 95 deletions
|
@ -1,5 +1,6 @@
|
|||
import React, { useLayoutEffect, useRef, useEffect } from "react";
|
||||
import "./Popover.css";
|
||||
import { unstable_batchedUpdates } from "react-dom";
|
||||
|
||||
type Props = {
|
||||
top?: number;
|
||||
|
@ -39,7 +40,7 @@ export function Popover({
|
|||
if (onCloseRequest) {
|
||||
const handler = (e: Event) => {
|
||||
if (!popoverRef.current?.contains(e.target as Node)) {
|
||||
onCloseRequest();
|
||||
unstable_batchedUpdates(() => onCloseRequest());
|
||||
}
|
||||
};
|
||||
document.addEventListener("pointerdown", handler, false);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue