fix(timeline): stabilize popovers on internal scroll + expand test coverage
B-1: useViewportPopover — ignoreScrollContainers option; scroll events originating inside the timeline canvas no longer close point-anchor popovers B-2: AllocationPopover, DemandPopover, NewAllocationPopover — thread scrollContainerRef through so horizontal timeline scroll is ignored B-3: AllocationPopover — staleTime 0 so SSE reconnect triggers immediate refetch B-4: useViewportPopover.test.ts — 6 new tests (scroll close, ignore container, resize close, style clamping) B-5: AllocationPopover.test.tsx — loading state + happy-path tests added Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { clsx } from "clsx";
|
||||
import type { RefObject } from "react";
|
||||
import { useState } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { AllocationStatus } from "@capakraken/shared";
|
||||
@@ -20,6 +21,7 @@ interface NewAllocationPopoverProps {
|
||||
anchorY: number;
|
||||
onClose: () => void;
|
||||
onCreated: () => void;
|
||||
ignoreScrollContainers?: RefObject<HTMLElement | null>[];
|
||||
}
|
||||
|
||||
function toDateInput(d: Date): string {
|
||||
@@ -38,6 +40,7 @@ export function NewAllocationPopover({
|
||||
anchorY,
|
||||
onClose,
|
||||
onCreated,
|
||||
ignoreScrollContainers,
|
||||
}: NewAllocationPopoverProps) {
|
||||
const { ref, style } = useViewportPopover({
|
||||
anchor: { kind: "point", x: anchorX - 10, y: anchorY },
|
||||
@@ -45,6 +48,7 @@ export function NewAllocationPopover({
|
||||
estimatedHeight: 440,
|
||||
onClose,
|
||||
ignoreSelectors: ["[data-entity-combobox-overlay='true']"],
|
||||
...(ignoreScrollContainers ? { ignoreScrollContainers } : {}),
|
||||
});
|
||||
const invalidateTimeline = useInvalidateTimeline();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user