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:
2026-07-20 00:56:47 +02:00
parent 260de48f41
commit c630d29ff6
6 changed files with 78 additions and 43 deletions
+6 -5
View File
@@ -54,11 +54,6 @@ export default function ChannelDiscovery({
parseCardSize(readAccount(LS.channelDiscoveryCardSize, null)),
);
const [cardPage, setCardPage] = useState(0);
// A narrowed or re-sorted list invalidates the page you were on — reset to the first, as the table
// does on its own filter/sort changes.
useEffect(() => {
setCardPage(0);
}, [search, sort]);
const query = useQuery({
queryKey: ["discovered-channels"],
@@ -103,6 +98,12 @@ export default function ChannelDiscovery({
const rows = (query.data ?? []).filter(
(c) => !q || `${c.title ?? ""} ${c.handle ?? ""}`.toLowerCase().includes(q)
);
// A re-sorted or RESIZED list invalidates the page you were on — reset to the first, as the table
// does on its own filter/sort changes. The row count is in the deps too, so a subscribe (which
// drops a channel from this tab) counts, not just an explicit filter change.
useEffect(() => {
setCardPage(0);
}, [search, sort, rows.length]);
const columns: Column<DiscoveredChannel>[] = [
// Actions first, mirroring the Subscriptions table (where it sits right after Prio) so the two