Skip to content

fix: fill {{response}} placeholders in networkRequest result actions - #506

Merged
divyanshub024 merged 1 commit into
mainfrom
dv/network-request-response-placeholder
Oct 16, 2026
Merged

divyanshub024 merged 1 commit into
mainfrom
dv/network-request-response-placeholder

Conversation

@divyanshub024

@divyanshub024 divyanshub024 commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Description

The Set Value Action docs store a response with {'key': 'data', 'value': '{{response}}'} inside a StacNetworkResult, but nothing ever filled that placeholder in. {{...}} values are only resolved against the registry when widgets are built, so the registry ended up holding the literal string {{response}}.

StacNetworkRequestParser now fills {{response}} placeholders in the matching result's action from the response body just before the action runs:

  • {{response}} is the whole body. {{response.user.name}} reads a nested field, and {{response.items[0].id}} or {{response.items.0.id}} read list items, the same path styles dynamicView supports.
  • A value that is only a placeholder keeps its type, so the docs example stores the actual map. A placeholder inside longer text, such as "Hi {{response.user.name}}", is inserted as text.
  • A placeholder whose path isn't in the body is left unchanged.
  • Error responses work the same way, using the error body.
  • If a result's action is itself a networkRequest, its own results are left alone so their {{response}} refers to that inner response.

The Network Request docs get a short "Using the response" section describing this.

Verified locally: dart analyze reports no issues in packages/stac, and the issue's repro now stores the response body.

Related Issues

Closes #496

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Code refactor
  • Build configuration change
  • Documentation
  • Chore

Summary by CodeRabbit

  • New Features
    • Network request result actions can now use {{response}} placeholders to access the full response body or nested fields, including list items.
    • Placeholders preserve the original value type when used alone and become text when embedded in a string. Unmatched paths remain unchanged.
    • Response values are substituted before the action runs, including for error status codes. The documentation also explains how to store responses with setValue.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9323a4a5-47d8-49d1-a0c2-e78fb166322f
📥 Commits

Reviewing files that changed from the base of the PR and between 03f669d and 2dc0b97.

📒 Files selected for processing: 2
  • docs/actions/network_request.mdx
  • packages/stac/lib/src/parsers/actions/stac_network_request/stac_network_request_parser.dart

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

📝 Walkthrough

The network request parser now resolves {{response}} placeholders in matched result actions before dispatch. It supports nested map paths and list indexes. The documentation describes whole-value and embedded substitutions, unresolved paths, and substitution for error status codes.

Changes: Response placeholder resolution

Layer / File(s) Summary
Resolve response placeholders before dispatch
packages/stac/lib/src/parsers/actions/stac_network_request/stac_network_request_parser.dart, docs/actions/network_request.mdx
The parser resolves placeholders against the response body before dispatching the matched action. Whole-value placeholders retain their type. Embedded values are substituted as text, with maps and lists JSON-encoded. The documentation describes supported paths and substitution behavior.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 2dc0b

This change fills response placeholders in network request result actions and documents the behavior. No actionable merge-blocking risk remains.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: resolving {{response}} placeholders in networkRequest result actions.
Linked Issues check Passed Issue #496 requires substitution of {{response}} before a matching network result action runs, with nested paths as an optional enhancement. The reviewed parser resolves whole-body, nested dot paths…
Out of Scope Changes check Passed The supplied change summary and reviewed files show two connected changes: response placeholder resolution in StacNetworkRequestParser and documentation for that behavior in `docs/actions/network_re…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Full details: Linked Issues check

Explanation

Issue #496 requires substitution of {{response}} before a matching network result action runs, with nested paths as an optional enhancement. The reviewed parser resolves whole-body, nested dot paths, and bracket or dotted list indexes. It preserves the type of a whole-placeholder value, interpolates embedded placeholders as text, preserves unresolved placeholders, uses response.data for error responses, and excludes nested network-request results. The reviewed Network Request documentation also describes the behavior and the existing Set Value example remains supported.

Full details: Out of Scope Changes check

Explanation

The supplied change summary and reviewed files show two connected changes: response placeholder resolution in StacNetworkRequestParser and documentation for that behavior in docs/actions/network_request.mdx. Both changes implement issue #496. No unrelated change is evidenced.

Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@divyanshub024
divyanshub024 merged commit 1b8b932 into main Oct 16, 2026
7 checks passed
@divyanshub024
divyanshub024 deleted the dv/network-request-response-placeholder branch October 16, 2026 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: {{response}} is never substituted in networkRequest result actions

1 participant