Database

Apply & Generate

Runtime behavior of Apply Data and Generate instance in SXL Studio: scope, value application rules, auto-hide, row generation, and Figma limitations.

Apply Data

Apply Data executes mapping rules and writes dataset values into matching Figma nodes.

Apply pipeline

  1. Build field map from all mappings (Target Layer -> fields).
  2. Collect target nodes in selected scope.
  3. Resolve dataset for each field (field dataset -> mapping dataset -> auto-detect).
  4. Compute row index (fill strategy + group fill mode + selection context).
  5. Evaluate expression and resolve directives/images/text.
  6. Run optional post-passes:
    • Auto-hide unused
    • Slot repeater
    • Composition templates ({{ ... }})

Scope

ScopeBehavior
selectiononly selected roots and descendants
pagecurrent page
documentall pages

selection is the safest default for iteration speed.

Field ordering when multiple mappings hit the same target

Apply prioritizes fields in this order:

  1. group cell/table,
  2. groups starting with cell/,
  3. remaining fields (stable by mapping id).

Value handling matrix

Input valueTarget nodeResult
plain textTEXTupdates characters
image sourceimage-capable nodesets IMAGE fill
@prop:...INSTANCE contextsets component properties
@node:..., @hide, @shownode / parent containernode property updates
@rows:Ncontainer with childrenshows first N children
boolean-like valueINSTANCEsets first BOOLEAN component prop

Auto-hide unused: actual behavior

When autoHideUnused=true and feature is available:

  • auto-hide runs per resolved row/container boundary,
  • it hides unused TEXT nodes in that boundary,
  • mapped targets and touched nodes are protected,
  • this is not “hide when value is empty” logic; it is mapping-target based cleanup.

Generate instance

Generate instance duplicates a template and applies one dataset row per generated row.

Preconditions

  • Generate feature must be enabled.
  • A mapping must be selected (Generate picker shows .map.json files with at least one field).
  • Dataset for that mapping must have rows.
  • Selection must be a valid template context (instance/component or frame/list host).

Row count

  • All: generate for all dataset rows.
  • Limit: generate min(limit, datasetRows).

High-level generation flow

  1. Resolve container + template from current selection.
  2. Optional Bind component validation (targetComponentKey).
  3. Clean previous siblings in container, keep template anchor.
  4. Duplicate rows and insert them in order.
  5. Run Apply for generated rows using the selected mapping.
  6. Resolve composition templates per row ({{...}}).
  7. Select generated nodes.

Duplication strategy

Frame/list hosts

  • row 1: existing template,
  • row 2: clone of template,
  • row 3+: clone of previous inserted row.

Slot hosts

  • default slot mode: row 2 from template, row 3+ from previous row,
  • table-row slot mode: every new row clones from previous row.

This strategy is used for stability with nested instance trees.

Apply phase after Generate

Generate applies:

  • the selected mapping to generated rows,
  • composition templates for each row.

Other mappings are not automatically applied in the current default pipeline.

Known Figma constraints (important)

1) Nested slot/table ghost row

For deep structures like WTable -> rows(SLOT) -> row(INSTANCE), Figma may keep one master-inherited row that cannot be safely removed by plugin API.

If cleanup cannot evict/hide it, a one-time notification is shown and manual deletion is required.

2) Performance floor on deep nested instances

Text writes on deep instance sublayers can be very slow (hundreds of ms per cell), especially in nested table setups.

For large datasets, prefer flat frame/auto-layout row templates when possible.

3) Font availability

Plugin preloads fonts, but unavailable fonts can still block text updates.

Practical recommendations

  1. Start with Selection scope for safe iteration.
  2. Keep target layer names explicit and unique.
  3. Enable Bind component for strict template validation in Generate.
  4. For large tables, split batches or use flatter row structures.
  5. Treat slot/table edge notifications as API constraints, not necessarily mapping errors.