-
Notifications
You must be signed in to change notification settings - Fork 10
fix: update onSave to pass nested tree values and handle save errors #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
23ed06d
5061700
f32dad7
5ea0769
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -136,8 +136,8 @@ export interface SettingsProps { | |||||||||
| values?: Record<string, any>; | ||||||||||
| /** Called when a field value changes. Receives the scope ID (subpage/page), field key, and new value. */ | ||||||||||
| onChange?: (scopeId: string, key: string, value: any) => void; | ||||||||||
| /** Called when the save button is clicked. Receives the scope ID and that scope's values only. */ | ||||||||||
| onSave?: (scopeId: string, values: Record<string, any>) => void; | ||||||||||
| /** Called when the save button is clicked. Receives the scope ID, nested tree values, and flat dot-keyed values. */ | ||||||||||
| onSave?: (scopeId: string, treeValues: Record<string, any>, flatValues: Record<string, any>) => void; | ||||||||||
|
Comment on lines
+139
to
+140
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Return type mismatch: The Since /** Called when the save button is clicked. Receives the scope ID, nested tree values, and flat dot-keyed values. */
- onSave?: (scopeId: string, treeValues: Record<string, any>, flatValues: Record<string, any>) => void;
+ onSave?: (scopeId: string, treeValues: Record<string, any>, flatValues: Record<string, any>) => void | Promise<void>;📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
| /** | ||||||||||
| * Custom render function for the save button area. | ||||||||||
| * Use this to provide your own translated save button. | ||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: getdokan/plugin-ui
Length of output: 895
🏁 Script executed:
# Get more context - read the full file or at least the type/interface definition wc -l src/components/settings/settings-context.tsxRepository: getdokan/plugin-ui
Length of output: 110
🏁 Script executed:
Repository: getdokan/plugin-ui
Length of output: 89
🏁 Script executed:
Repository: getdokan/plugin-ui
Length of output: 15495
🏁 Script executed:
Repository: getdokan/plugin-ui
Length of output: 1625
🏁 Script executed:
Repository: getdokan/plugin-ui
Length of output: 911
🏁 Script executed:
Repository: getdokan/plugin-ui
Length of output: 1625
Breaking change:
onSavesignature updated — some call sites still need updating.The new signature
(scopeId, treeValues, flatValues)is a breaking change. Several usages have not been updated:src/components/settings/Settings.stories.tsxline 1084 still uses 2 parameterssrc/DeveloperGuide.mdxandDEVELOPER_GUIDE.mdexamples still use 2 parametersUpdate these call sites to accept the new third parameter
flatValuesor ignore it with a rest parameter if unused.🤖 Prompt for AI Agents