fix tenant filter

This commit is contained in:
Oliver Kieselbach
2026-03-17 19:26:16 +01:00
parent ddb8daceee
commit f2c5d43efc
3 changed files with 15 additions and 2 deletions
@@ -1 +1 @@
463
464
@@ -68,6 +68,12 @@ export default function Home() {
// Track if galactic admin mode has been initialized (to skip initial mount in useEffect)
const hasGalacticModeInitialized = useRef(false);
// Refs for SignalR handlers to access current filter state (avoids stale closures)
const tenantIdFilterRef = useRef(tenantIdFilter);
tenantIdFilterRef.current = tenantIdFilter;
const galacticAdminModeRef = useRef(galacticAdminMode);
galacticAdminModeRef.current = galacticAdminMode;
// Track if we've joined the tenant group to prevent duplicate joins
const hasJoinedGroup = useRef(false);
@@ -278,6 +284,13 @@ export default function Home() {
const handleNewSession = (data: { sessionId: string; tenantId: string; session: Session }) => {
console.log('New session registered', data);
// In galactic admin mode with an active tenant filter, ignore sessions from other tenants
const activeFilter = tenantIdFilterRef.current.trim();
if (galacticAdminModeRef.current && activeFilter && data.tenantId !== activeFilter) {
console.log(`Ignoring newSession from tenant ${data.tenantId} (filtered to ${activeFilter})`);
return;
}
if (data.session) {
setSessions(prevSessions => {
const sessionIndex = prevSessions.findIndex(s => s.sessionId === data.session.sessionId);
File diff suppressed because one or more lines are too long