appsmithorg / appsmithorg/appsmith-docs

[Docs]: Provide best practices in using Widget's selectedValue property or pass parameters to the Query/API as alternative to storeValue

オープン
#602 コメント 1 件 リアクション 0 件 担当者 1 名 @harshilp24 に割り当て済み GitHub で見る
A-Force Documentation medium Ready for Doc Team User Education Pod
主要言語
MDX
スター
97
フォーク
280
平均マージ
4時間 32分
マージ済み PR(30日)
8

説明

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Documentation Link

https://docs.appsmith.com/reference/appsmith-framework/query-object

### Discord/slack/intercom Link

_No response_

### Describe the problem

Many users use the storeValue function unnecessarily in many places.
There have been scenarios where when a widget like Select button is updated, they call the storeValue function in onOptionChange first, and then immediately run an API that is using the stored value.
storeValue is an expensive function and needs to be used only when needed. It would also take time, so calling an API immediately after would not have the latest value of the store updated by then. You would have to correctly use async/await to avoid running an API/Query with outdated values.

And most likely they wouldn't be needing the stored value for any other case except to run the Query whenever a CTA is triggered.

### Describe the improvement

This can clearly be avoided by educating the user to directly use the widget's selected value.
Eg JSObject1.formData.id or Select1.selectedOptionValue or DatePicker1.formattedData, etc

Another way to do it, would be to retrieve these values from the above mentioned widgets and pass it as a query-object to the API/Query. This can be accessed inside the queries as this.params, hence allowing the API to be generic without being dependant on any specific widget value.

Any app that is using storeValue function this way to achieve these workflows, would most likely have a lot of them. And the performance of the app can increase significantly by using the above mentioned alternatives wherever possible.

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

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

評価

この issue はまだ評価されていません。

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

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