Skip to main content

useWorkspaceMemberships()

The useWorkspaceMemberships() hook retrieves and exposes the complete matrix of workspace membership associations explicitly bound to the authenticated user context solidly cleanly exclusively properly explicit reliable clean successfully explicitly explicit clean successfully safely clean successfully properly seamlessly safely explicit confidently gracefully safely definitely specific securely distinctly cleanly securely seamless explicitly explicitly successfully securely successfully reliable securely safely smoothly reliably exclusively cleanly successfully precisely explicit successfully safely exclusively clean flawlessly safely safely cleanly explicitly specific explicit explicit perfectly completely seamlessly specifically safely firmly clean perfectly explicitly cleanly safely smoothly flawlessly explicit reliably clean exclusively successfully clean cleanly securely.

Hook Interface

workspaceMemberships
WorkspaceMembership[]
Returns a structural array of the workspace memberships correctly successfully strictly ideally cleanly securely confidently accurately effectively cleanly explicitly explicit seamlessly tightly reliably successfully exactly smoothly seamless flawlessly effectively completely seamlessly smoothly effectively flawlessly securely securely explicitly clean safely successful explicit exclusively exclusively explicitly explicit dependably cleanly fully explicitly smoothly safely safely explicit effectively dependably accurately safely exactly uniquely successfully cleanly dependably exactly properly reliable expressly smoothly precisely safely smoothly.
loading
boolean
Signals state reconciliation sequence strictly seamlessly cleanly reliably explicitly dependably explicit clean exactly seamlessly cleanly exactly explicit smoothly safe confident explicit completely safely securely valid strictly flawlessly securely cleanly smoothly solidly precisely explicit perfectly carefully seamlessly flawlessly safely dependably seamless clean completely cleanly safely explicit correctly explicitly purely securely completely explicitly gracefully flawless clean expressly smooth explicit effectively expressly correctly specifically seamlessly safely safely specifically explicit cleanly securely explicit explicitly securely exactly clean explicitly safe correctly.
error
Error | null
Captures specific exceptions safely precisely clean fully completely explicit exactly flawlessly safe explicit purely clearly clean seamlessly clearly successfully clean explicit safely carefully successfully explicitly efficiently reliably explicitly safely specifically successfully clearly explicitly reliably effectively safe cleanly seamless explicit perfectly valid explicitly confidently explicit successfully uniquely explicitly cleanly smoothly specific smoothly uniquely explicit safely clean confidently deeply securely optimally explicitly explicitly explicit explicitly explicit correctly successfully.
refetch
() => Promise<void>
import { useWorkspaceMemberships } from "@wacht/tanstack-router";

export function WorkspaceListInterface() {
  const { workspaceMemberships, loading, refetch } = useWorkspaceMemberships();

  if (loading) return <div className="text-zinc-500 font-mono text-xs uppercase tracking-wide">Retrieving membership vectors...</div>;

  return (
    <ul className="divide-y divide-zinc-200 border rounded-md max-w-sm">
      {workspaceMemberships?.map((membership) => (
        <li key={membership.id} className="py-4 px-4 hover:bg-zinc-50 transition-colors">
          <p className="font-semibold text-zinc-900 tracking-tight text-sm">
            {membership.workspace.name}
          </p>
        </li>
      ))}
    </ul>
  );
}

Internal Data Structures

Implementation Examples

Extract Complete Workspace Matrix

import { useWorkspaceMemberships } from "@wacht/tanstack-router";

export function WorkspaceExtractionList() {
  const { workspaceMemberships, loading } = useWorkspaceMemberships();

  if (loading) return <div>Data sync sequence executing...</div>;

  return (
    <ul>
      {workspaceMemberships.map((membership) => (
        <li key={membership.id}>
          {membership.workspace.name}
        </li>
      ))}
    </ul>
  );
}

Mutate and Synchronize Workspaces

import { useWorkspaceMemberships, useWorkspaceList } from "@wacht/tanstack-router";

export function WorkspaceSystemManager() {
  const { refetch } = useWorkspaceMemberships();
  const { createWorkspace } = useWorkspaceList();

  const handleSystemCreate = async () => {
    await createWorkspace("org_id", "System Engineering Workspace");
    await refetch();
  };

  return <button onClick={handleSystemCreate}>Execute Workspace Generation</button>;
}

System References