From 1c5b2d36d9d8e02f2269fef89e96f1db6c38b61e Mon Sep 17 00:00:00 2001 From: Lukas Date: Thu, 23 Apr 2026 08:25:32 +0200 Subject: [PATCH] docs: Remove completed TASK-BUG-08 from Tasks.md Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- Docs/Tasks.md | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/Docs/Tasks.md b/Docs/Tasks.md index f229737..69deb48 100644 --- a/Docs/Tasks.md +++ b/Docs/Tasks.md @@ -1,33 +1,3 @@ -### TASK-BUG-08 — `AssignActionDialog` and `AssignFilterDialog` Call `useJails()` When Closed - -**Where found** -`frontend/src/components/config/AssignActionDialog.tsx` line 71 and `frontend/src/components/config/AssignFilterDialog.tsx` line 71. Both components call `useJails()` unconditionally at the top of the component body. The parent mounts these dialogs regardless of their `open` prop (so they can animate in), meaning `GET /api/jails` is fired every time the Config page tab containing these dialogs renders, even when the dialogs are never opened. - -**Goal** -Gate the `useJails()` call behind the `open` prop. Because React hooks cannot be called conditionally, the fix is to extract the dialog body into a separate inner component that is only rendered when `open` is true: -```tsx -export function AssignActionDialog({ open, ... }) { - return open ? : null; -} -function AssignActionDialogInner({ ... }) { - const { jails, ... } = useJails(); - ... -} -``` -This way `useJails()` only mounts (and fetches) when the dialog is actually open. - -**Possible traps and issues** -- Fluent UI Dialog animations may require the wrapper element to always exist for the open/close animation to work. In that case keep the `` wrapper in the outer component and only render the dialog content conditionally. -- Since `useJails()` is already called on `JailsPage` and `JailOverviewSection`, ideally jail data would be passed as a prop rather than fetched again in the dialog. Longer term, a jail context or shared data store would eliminate redundant fetches. - -**Docs changes needed** -None required. - -**Why this is needed** -Config tab loads currently trigger `GET /api/jails` from up to four independent call sites simultaneously: `JailsPage`, `JailOverviewSection`, `AssignActionDialog`, and `AssignFilterDialog`. This creates unnecessary backend load. - ---- - ### TASK-BUG-09 — `linesCount` Input in `ServerHealthSection` Fires Fetch on Every Keystroke **Where found**