react-better-html 1.1.255 → 1.1.256

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -2413,6 +2413,10 @@ var ModalComponent = forwardRef7(function Modal({
2413
2413
  const { app } = useBetterHtmlContextInternal();
2414
2414
  const { colorTheme } = useBetterCoreContext4();
2415
2415
  const dialogRef = useRef2(null);
2416
+ const onOpenRef = useRef2(onOpen);
2417
+ onOpenRef.current = onOpen;
2418
+ const onCloseRef = useRef2(onClose);
2419
+ onCloseRef.current = onClose;
2416
2420
  const [isOpened, setIsOpened] = useBooleanState2(false);
2417
2421
  const [isOpenedLate, setIsOpenedLate] = useBooleanState2(false);
2418
2422
  const onClickOpen = useCallback4(() => {
@@ -2427,20 +2431,20 @@ var ModalComponent = forwardRef7(function Modal({
2427
2431
  false
2428
2432
  );
2429
2433
  }
2430
- onOpen?.();
2431
- }, [onOpen, urlQuery, name]);
2434
+ onOpenRef.current?.();
2435
+ }, [urlQuery, name]);
2432
2436
  const onClickClose = useCallback4(
2433
2437
  (event) => {
2434
2438
  event?.stopPropagation();
2435
2439
  setIsOpened.setFalse();
2436
- onClose?.();
2440
+ onCloseRef.current?.();
2437
2441
  if (urlQuery && name) urlQuery.removeQuery(`${name}-modal`, false);
2438
2442
  setTimeout(() => {
2439
2443
  dialogRef.current?.close();
2440
2444
  setIsOpenedLate.setFalse();
2441
2445
  }, 0.2 * 1e3);
2442
2446
  },
2443
- [onClose, urlQuery, name]
2447
+ [urlQuery, name]
2444
2448
  );
2445
2449
  const onKeyDown = useCallback4(
2446
2450
  (event) => {