Skip to content

Middlewares

Middlewares are functions that wrap the form’s reactive store and observe (or mutate) every action that flows through it. They run on every state change and can be composed.

GolemUI ships a few middlewares you can opt into:

MiddlewareWhat it does
loggerMiddlewareLogs each action and the resulting state to the console — handy during development.
jsonSchemaMiddlewareValidates each incoming change against a JSON Schema and rejects invalid mutations.
devToolsMiddlewarePipes actions to the Redux DevTools extension for time-travel debugging.

Pass an array of middlewares to <gui-form>. The framework adapter forwards the array to the underlying store.

import * as Core from '@golemui/core';
const middlewares = [Core.devToolsMiddleware()];

Then pass middlewares as a prop on your framework’s <FormComponent> / <gui-form>.

See Extending GolemUI / Middlewares for the middleware contract and a worked example.