docs: Remove completed TASK-BUG-08 from Tasks.md
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -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 ? <AssignActionDialogInner ... /> : 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 `<Dialog open={open}>` 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
|
### TASK-BUG-09 — `linesCount` Input in `ServerHealthSection` Fires Fetch on Every Keystroke
|
||||||
|
|
||||||
**Where found**
|
**Where found**
|
||||||
|
|||||||
Reference in New Issue
Block a user