Skip to content

Commit 9862cdb

Browse files
eliandoranclaude
andcommitted
fix(calendar): place the event popover again once its note fills it
Popper measures a popover once and watches the window for the rest, and what a popover holds arrives after it does — the note's editor mounts, its promoted attributes fill in. A card placed while it was short then stands where a short card had the room to stand, and its foot falls off the bottom of the screen. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 6f8c173 commit 9862cdb

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

apps/client/src/widgets/react/Popover.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import { createPopper, Instance, Placement, VirtualElement } from "@popperjs/cor
44
import clsx from "clsx";
55
import { ComponentChildren } from "preact";
66
import { createPortal } from "preact/compat";
7-
import { useEffect, useRef } from "preact/hooks";
7+
import { useCallback, useEffect, useRef } from "preact/hooks";
88

99
import { FLOATING_LAYER_SELECTOR, isWithinFloatingLayer } from "./floating_layers";
10+
import { useResizeObserver } from "./hooks";
1011

1112
export interface PopoverProps {
1213
/**
@@ -94,6 +95,10 @@ export default function Popover({ getAnchorRect, placement, updateKey, className
9495
void popperRef.current?.update();
9596
}, [ updateKey ]);
9697

98+
// Placed again whenever what is placed changes size: what a popover holds arrives after it does
99+
// — a note's editor mounting, its promoted attributes filling in — and Popper measures it once.
100+
useResizeObserver(elRef, useCallback(() => void popperRef.current?.update(), []));
101+
97102
useEffect(() => {
98103
if (!onDismiss) return;
99104

0 commit comments

Comments
 (0)