Skip to main content

Function: setContext()

setContext(context, permissions): void

Defined in: src/state/controls.ts:26

The single write entry point for state.context.

Every context-write consumer — host controls, miniapp dispatches, authentication bridges — funnels through this function. The caller binds the permission mask at the boundary (HOST_PERMISSIONS for host code, a miniapp's declared permissions for miniapp dispatches); the storm merge itself is unconditional once the allow-list has been computed. This keeps filterByPermissions as the ONE place where write permissions are enforced.

Side-effect fields (action, settings.experience, project, location) are intentionally NOT handled here. Those cases live in createContextChangeHandler and run alongside this helper — not through it — because they perform work outside the storm.

When the allow-list is empty, the storm dispatch is skipped so subscribers aren't notified with an identity merge.

Parameters

context

Partial<ITransferContext>

permissions

MiniappPermissions

Returns

void