vercel-labs / vercel-labs/json-render

$item in action.params returns path string instead of value (0.19.0, React)

Open
#292 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
16.8k
Forks
901
Avg merge
3h 14m
Merged PRs (30d)
4

Description

Hi @ctate :

I noticed a small inconsistency when using { "$item": "field" } inside action.params within a repeated element. It currently returns a JSON path string (e.g., "list/0/url") rather than the actual field value. In contrast, { "$bindItem": "url" } works as expected.

We would be very grateful if you could take a look at this. 🙏

Works correctly: { "$bindItem": "url" } → actual value
Observed issue: { "$item": "url" } → "list/0/url"

Schema snippet

"task-card": {
  "type": "Card",
  "on": {
    "click": {
      "action": "openLink",
      "params": {
        "url": { "$item": "url" }   // ❌ becomes "list/0/url"
      }
    }
  }
}

Steps to reproduce
State has list with items containing url.

Use repeat on /list.

Inside repeated element, add action with params: { url: { "$item": "url" } }.

Trigger action → parameter is "list/0/url", not the actual URL.

Change to $bindItem → works correctly.

Expected vs actual
Expected: { "$item": "url" } → actual URL string

Actual: → path string like "list/0/url"

Environment
json-render: 0.19.0

Framework: React

Workaround
Use { "$bindItem": "url" } instead of $item inside action params.

We would really appreciate it if this could be fixed. Thank you!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in the action.params path inside a repeated element using the provided schema and state shape. Compare $item with the working $bindItem behavior, then verify that action parameters receive the actual URL value rather than a path string while the existing workaround behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.