Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

648 B
Raw Blame
import { useActiveWorkspaceSlug } from '@/business/client/hooks/useActiveWorkspaceSlug';
import { useDisplayedTabUrl } from '@/features/Electron/TabHost/displayedTab';

import { resolveNavPanelKey } from './routeKey';

// The route-owned panel registers from inside the tab's layout, so keying the
// panel by the clicked tab before its pane is on screen finds no entry and
// paints the skeleton.
export const useActiveNavKey = () => {
  const url = useDisplayedTabUrl() ?? '/';
  const activeWorkspaceSlug = useActiveWorkspaceSlug();
  const pathname = url.split(/[#?]/)[0] || '/';

  return resolveNavPanelKey(pathname, activeWorkspaceSlug);
};