Fluent Commerce Logo
Docs

Data Injector Component

UI Component

Changed on:

7 Sept 2026

Overview

The Data Injector is a Mystique content component that copies values from the current data context into a nested array or object, so descendant components can read data that would otherwise sit outside their scope.It does not render any visible UI of its own - it enriches the data passed to its descendants.
Plugin NameCore
The standard library of mystique components. 
0000-00-00

v1.0.0

Initial changelog entry.

Alias

fc.data.injector

Detailed technical description

What Gets Injected

The Data Injector reads from the current `DataContext` (or from an optional `data` prop when you want to override the context) and writes selected values onto a target identified by the `source` prop:
  • When `source` resolves to an array, the injected keys are merged onto each item, preserving the item's other keys
  • When `source` resolves to an object, the injected keys are merged onto that object
  • When `source` resolves to a primitive (a string or number), the data is passed through unchanged
  • A missing path, or an explicit `null` / `undefined`, resolves to an empty object (`{}`) and is treated as the object case - it receives only the injected keys
Each entry in `inject` is read from the data by its `path` and written onto the target under a key:
  • `path` is a dot-path such as `locations` or `node.retailer`
  • The written key is the entry's `alias`; when no `alias` is given it defaults to the last segment of `path` (so `node.retailer` is written as `retailer`, and `locations` as `locations`)
  • If an `inject` path does not exist in the data, it resolves to an empty object (`{}`) on the target

Behavior

  • The `source` must resolve to an object or an array of objects. When `source` is an array, every item is merged unconditionally - the component does not check that each item is an object - so non-object items are not supported:
    • `null`, numbers, and booleans are replaced by an object containing only the injected keys
    • strings are expanded into character-indexed keys
  • A nested `source` dot-path (for example `strategy.fulfilments`) is deep-set, preserving the surrounding keys
  • The component does not mutate the source data - the enriched copy is passed to descendants as a data override, so the original context is untouched
  • An empty `source` array and an empty `inject` list are both handled without error
It is registered under `category: content`.

Explanation Through an Example

With `source: "fulfilments"` and `inject: [{ path: "locations", alias: "locs" }]`, the sibling `locations` array is copied onto every fulfillment item under `locs`:
1{
2  "fulfilments": [
3    { "location": { "ref": "F_1722", "name": "Sydney Warehouse" } },
4    { "location": { "ref": "F_1850", "name": "Melbourne Warehouse" } }
5  ],
6  "locations": [
7    { "ref": "F_7777", "name": "Melbourne Warehouse" }
8  ]
9}
1{
2  "fulfilments": [
3    {
4      "location": { "ref": "F_1722", "name": "Sydney Warehouse" },
5      "locs": [{ "ref": "F_7777", "name": "Melbourne Warehouse" }]
6    },
7    {
8      "location": { "ref": "F_1850", "name": "Melbourne Warehouse" },
9      "locs": [{ "ref": "F_7777", "name": "Melbourne Warehouse" }]
10    }
11  ],
12  "locations": [
13    { "ref": "F_7777", "name": "Melbourne Warehouse" }
14  ]
15}

Properties

NameTypeRequiredDefaultDescription
`source``string`YesNoneDot-path to the array or object within the data to enrich (for example `fulfilments` or `strategy.fulfilments`)
`inject``InjectItem[]`YesNoneList of values to read from the data and write onto the `source` target
InjectItem
NameTypeRequiredDefaultDescription
`path``string`YesNone
  • Dot-path read from the data (for example `locations` or `node.retailer`)
  • A path that does not resolve becomes an empty object (`{}`)
`alias``string`NoNoneWhen the target key already exists on the item, the injected value overwrites the existing one (to avoid the repeating value overwriting)

Configuration example

1{
2  "component": "fc.data.injector",
3  "props": {
4    "source": "fulfilments",
5    "inject": [
6      { "path": "locations", "alias": "locs" }
7    ]
8  },
9  "descendants": []
10}

Version History

2026-09-07

v26.9.7

Initial release.

Recommended Placement

Wrap the descendant components that need the enriched data. The Data Injector renders only its descendants, so place it in the component tree at the point where a nested array or object must gain access to sibling data - for example, making shared location data available to nested strategy or fulfillment items in the Sourcing tab manifests.