adopted-ember-addons / adopted-ember-addons/ember-set-helper

Documentation around setting nested keys

オープン
#31 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
JavaScript
スター
69
フォーク
9
PR マージ指標
30日以内にマージされた PR はありません

説明

Have just spent about an hour trying to convert this:
```oninput={{action (mut this.creativeForForm.shareContent.shareCommentary.text) value="target.value"}}```

into this:
```{{on "input" (pick "target.value" (set this "creativeForForm.shareContent.shareCommentary.text"))}}```

I would have expected this to work per your docs, since the format generally appears to be `set thisContext "path" newValue`, though after a while it apparent that no examples of nested paths are actually provided in the docs. It says `dynamic paths can be provided`, but still sticks to the syntax of `set thisContext pathExpressedAsVariable`.

Eventually through trial and error, I discovered that
``` {{on "input" (pick "target.value" (set this.creativeForForm.shareContent.shareCommentary.text))}}```

works, although this is not documented at all (but is the same format as `mut` but this style isn't mentioned once in the docs). Given your API for everything else, I even would have expected
``` {{on "input" (pick "target.value" (set this.creativeForForm.shareContent.shareCommentary "text"))}}```
over the one that actually ended up working.

Would appreciate a callout added to the docs on how exactly setting nested paths should be achieved then as I don't want to be using an undocumented method if this is not stable. Thanks!

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start by reading the existing documentation for the set helper and its dynamic-path examples. Document the supported syntax for setting nested paths, including the form shown in the issue, and clarify whether that usage is stable. Done means a newcomer can find an accurate nested-path example and understand the expected arguments.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript
領域
documentation
issue の種類
ドキュメント
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。