Documentation
Open app

useAppContext

useAppContext() is the primary runtime API for every hosted native surface. Import it from @sota/platform; it throws when no app surface provider is mounted.

TSX
import { useAppContext } from '@sota/platform';

export function RuntimeDetails() {
  const context = useAppContext();
  return (
    <dl>
      <dt>App</dt><dd>{context.appId}@{context.appVersion}</dd>
      <dt>Organization</dt><dd>{context.organizationId}</dd>
      <dt>Workspace</dt><dd>{context.workspaceId ?? 'none'}</dd>
      <dt>Surface</dt><dd>{context.surface}</dd>
    </dl>
  );
}
FieldMeaning
appId, appVersionThe current app package selected for this lane.
organizationId, workspaceIdVerified tenant context. workspaceId may be absent outside workspace scope.
surfaceThe current surface kind; use it for presentation differences, not authorization.
theme, locale, tCurrent host presentation and localization.
fetchThe same scoped data-plane function returned by useAppFetch.
lifecycleMount-owned cancellation and cleanup primitives.
uiHost UI actions such as toast, navigation, artifact, and lightbox.

Values are stamped from the server-resolved execution. Never reconstruct organization, workspace, app, or environment identity from URLs or local storage.

Contents

Esc

Search titles and body text across every chapter.