-
Notifications
You must be signed in to change notification settings - Fork 260
Open
Labels
DocumentationImprovements or additions to documentationImprovements or additions to documentationUser Education PodIssues related to user educationIssues related to user education
Description
Problem Statement
Hello,
I was reading the documentation on Use Appsmith store and I noticed that the code example provided does not represent a good practice, since a getter (fetch_name) is simultaneously acting as a setter.
The Issue: The function is intended to retrieve data, but it explicitly calls storeValue('name', 'sam', true). This means the function mutates the store every time it is called to read it.
Current Example in Docs:
export default {
fetch_name () {
storeValue('name', 'sam', true); // ππΌ This sets the value instead of just fetching it
return appsmith.store.name;
},
update_name () {
storeValue('name', 'ben', true);
return appsmith.store.name;
},
}Use Cases / User query reference
Proposed Changes:
I suggest updating the example to clearly separate the concerns (Get vs. Set)
export default {
// Pure getter
fetch_name () {
return appsmith.store.name;
},
// Setter
update_name () {
storeValue('name', 'ben', true);
return appsmith.store.name;
},
}This change would make the distinction between reading from the store and writing to the store much clearer for new users.
BR
Audio/Video Recording
No response
Product Requirements Document
No response
Other Relevant Links
No response
Checklist
- Reviewed existing documentation to ensure this request is not duplicated.
- Attached relevant media or supporting materials like links to the PRD, feature recordings, Slack or Discord links, and any other relevant resources.
Metadata
Metadata
Assignees
Labels
DocumentationImprovements or additions to documentationImprovements or additions to documentationUser Education PodIssues related to user educationIssues related to user education