From 17c8fc78e6452fc2b392e82322cc7e041972a99b Mon Sep 17 00:00:00 2001 From: TheGeneralist <180094941+thegeneralist01@users.noreply.github.com> Date: Fri, 9 Oct 2026 19:23:10 +0200 Subject: [PATCH] fix(frontend): admin Archives tab shows paths; drop path from non-admin view The server now returns archive_path only to admins. The non-admin screen no longer renders an empty line, and the admin tab re-fetches the archive list so paths show even when the cached list was fetched before login. Co-Authored-By: Claude Sonnet 5.5 --- frontend/src/components/AdminView.jsx | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/frontend/src/components/AdminView.jsx b/frontend/src/components/AdminView.jsx index acddb02..760f365 100644 --- a/frontend/src/components/AdminView.jsx +++ b/frontend/src/components/AdminView.jsx @@ -2,7 +2,7 @@ import { useState, useEffect, useContext, useCallback } from 'react' import { AuthContext } from '../App.jsx' import { listAdminUsers, createAdminUser, setUserStatus, assignRole, removeRole, - listRoles, createRole + listRoles, createRole, fetchArchives } from '../api.js' const ROLE_ADMIN = 4 @@ -14,6 +14,9 @@ export default function AdminView({ archives }) { const [tab, setTab] = useState('users') const [users, setUsers] = useState([]) const [roles, setRoles] = useState([]) + // The server only includes archive_path for admins, and the archives prop may have been + // fetched anonymously (before login), so admins re-fetch the list for the Archives tab. + const [adminArchives, setAdminArchives] = useState(null) const [loading, setLoading] = useState(false) const [error, setError] = useState(null) @@ -47,6 +50,11 @@ export default function AdminView({ archives }) { useEffect(() => { refresh() }, [refresh]) + useEffect(() => { + if (!isAdmin) return + fetchArchives().then(setAdminArchives).catch(() => {}) + }, [isAdmin]) + async function handleToggleStatus(user) { const next = user.status === 'active' ? 'disabled' : 'active' try { @@ -102,7 +110,6 @@ export default function AdminView({ archives }) { {archives.map(a => (
{a.label} -
{a.archive_path}
))} @@ -204,10 +211,10 @@ export default function AdminView({ archives }) {

Mounted Archives

- {archives.map(a => ( + {(adminArchives ?? archives).map(a => (
{a.label} -
{a.archive_path}
+ {a.archive_path &&
{a.archive_path}
}
))}