fix(managers): address the E4 S3 code-review round 2 findings
- The portalled tag picker now FOLLOWS its trigger on scroll (rAF-coalesced) instead of closing. Closing on every wheel tick was a regression for the table, where the menu used to travel with its row; it still closes once the trigger leaves the viewport (nothing left to anchor to) or on resize. - Place the menu by MEASUREMENT, not a px estimate: it opens below, then the layout effect flips it above only if the real box overflows. The old `rows * 30px` guess read short at font-scale 1.3 (the rows are rem), which could leave a fixed menu hanging off the bottom with no way to reach it. - `toggle` only opens once a position exists, so the `open && coords` gate can never show a stale anchor. - One owner for "is there anything to page": `hasPagerContent()` lives in Pager and DataTable calls it, instead of both re-deriving the rule — that drift is what left empty control bands behind in the first place. - Reset the card page on the row COUNT too, not just the filter inputs, so an unsubscribe or a shrinking refetch can't leave a stale page to spring back. - `parseCardSize` clamps to the sizes the pager actually offers (like clampView / clampStatus), so the select can't display one value while the grid pages by another. - VirtualGrid's docblock now carries the stacking-context constraint: its rows are transformed, so anything floating an item renders must portal out.
This commit is contained in:
@@ -4,7 +4,7 @@ import { ArrowDown, ArrowUp, ListFilter, X } from "lucide-react";
|
||||
import { useDismiss } from "../lib/useDismiss";
|
||||
import { useScrollFade } from "../lib/useScrollFade";
|
||||
import { sortRows, cycleSort, type SortState } from "../lib/columnSort";
|
||||
import Pager from "./Pager";
|
||||
import Pager, { hasPagerContent } from "./Pager";
|
||||
import { PageToolbar } from "./PageShell";
|
||||
|
||||
// A reusable, client-side data table: per-column sort + filter (in the header) + pagination,
|
||||
@@ -285,9 +285,8 @@ export default function DataTable<T>({
|
||||
// are header controls and belong only at the top.
|
||||
// Stays NULLABLE: the wrappers below decide whether to render a controls row at all, and an always
|
||||
// -truthy element would leave an empty `my-3` band (and an empty in-band PageToolbar) on a table
|
||||
// with nothing to page.
|
||||
const pagerNode =
|
||||
totalPages > 1 || sorted.length > 0 ? (
|
||||
// with nothing to page. The emptiness rule itself lives in Pager, so the two can't drift apart.
|
||||
const pagerNode = hasPagerContent(sorted.length, size) ? (
|
||||
<Pager
|
||||
page={safePage}
|
||||
size={size}
|
||||
|
||||
Reference in New Issue
Block a user