Skip to main content

filter

Pass filter to useHotglue to limit the widget to specific flows or connectors. The filter is applied when the widget initializes, so the widget only fetches the flows and connectors you ask for. This makes the widget ready faster, especially in environments with many flows. The same filter is used by <Widget /> and <Connections />, so you don’t need to pass it to the components.

Example (React)

Example (JavaScript)

The CDN version accepts the same filter in its configuration:

Type and default

  • flows: Array<string> (optional)
    • Flow IDs to load and show.
  • connectors: Array<string> (optional)
    • Connector IDs to load and show.
filter is optional. When set, it must include flows, connectors, or both. When it is not set, the widget loads every flow in the environment.

Behavior

  • Only flows: only the listed flows are loaded. If any flow ID does not exist in the environment, initialization fails with an InvalidFlowIdError whose message lists the missing flow IDs.
  • Only connectors: only the flows that contain at least one of the listed connectors are loaded.
  • Both flows and connectors: flows decides which flows are loaded. connectors still restricts which connectors are shown in those flows.
  • A single connector: when connectors has exactly one ID, the widget fetches only that linked connector instead of every linked connector in the flow. This is the common case when you open the widget for one connector, for example from a magic link.
  • link() for a flow outside the filter: still works. The widget fetches that flow’s connectors when link() is called.
  • Changing the tenant: if openWidget() or link() receives a different tenantId than the current one, the widget reinitializes for that tenant with the same filter.
The filter is compared by value, so passing a new object literal on each render does not reinitialize the widget. Changing its contents does.

Migrating from the component filter prop

The filter prop on <Connections /> and <Widget /> is deprecated. It still works, but it only hides flows and connectors after the widget has loaded all of them, so it does not make the widget faster.
Move the filter from the component to useHotglue:
We recommend using only the useHotglue filter. If you pass both, the useHotglue filter decides what is loaded and the component prop decides what is shown. A flow requested by the component prop that the useHotglue filter did not load is not shown.