From ae85b914688de0b22a63de8dd37279ffb7ab99a2 Mon Sep 17 00:00:00 2001 From: Schalli Date: Fri, 24 Jul 2026 12:10:39 +0200 Subject: [PATCH] fix(admin): refresh sidebar after module toggle on admin page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Activating/deactivating a module from the admin modules page updated only the page's local state — the sidebar (which refetches its active-module list on the shared marketplace-store sidebarRefreshKey signal) was never bumped, so the module's nav link only appeared/disappeared after a manual full page reload. The marketplace pages already call bumpSidebarRefresh() after a toggle; mirror that here. Co-Authored-By: Claude Opus 4.8 --- apps/web/src/app/(portal)/admin/modules/page.tsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/apps/web/src/app/(portal)/admin/modules/page.tsx b/apps/web/src/app/(portal)/admin/modules/page.tsx index fa7ad70..2a41422 100644 --- a/apps/web/src/app/(portal)/admin/modules/page.tsx +++ b/apps/web/src/app/(portal)/admin/modules/page.tsx @@ -3,6 +3,7 @@ import { useCallback, useEffect, useState } from 'react'; import { useTranslations } from 'next-intl'; import { useAuthStore } from '@/lib/stores/auth-store'; +import { useMarketplaceStore } from '@/lib/stores/marketplace-store'; const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001'; @@ -27,6 +28,11 @@ export default function AdminModulesPage() { const t = useTranslations('adminModules'); const tCommon = useTranslations('common'); const currentUser = useAuthStore((s) => s.user); + // Shared signal that makes the sidebar refetch its active-module list + // (same mechanism the marketplace pages use). Without bumping this after a + // toggle here, an activation from the admin page only updates local state — + // the sidebar link would not appear until a full page reload. + const bumpSidebarRefresh = useMarketplaceStore((s) => s.bumpSidebarRefresh); const [modules, setModules] = useState([]); const [activations, setActivations] = useState>(new Map()); @@ -91,6 +97,9 @@ export default function AdminModulesPage() { } return next; }); + // Refresh the sidebar so the (de)activated module's link appears/ + // disappears immediately, without a manual full page reload. + bumpSidebarRefresh(); } else { const body = await res.text().catch(() => ''); setError(`${res.status}: ${body}`);