-
Notifications
You must be signed in to change notification settings - Fork 93
Feat/on save settings #121
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
base: main
Are you sure you want to change the base?
Conversation
|
My main feedback is that we don't need to add the new "handle" functions. Just call onSave?.() after the success toasts |
|
Okay, I will revise this. I try not to modify or add anything to your original functions |
|
@daveycodez Hi, can you please review this and let me know if it can be merged |
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.
Just need to delete this bun file or put in in gitignore
| }) | ||
| } | ||
|
|
||
| onSave?.() |
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.
I think this onSave should be called inside the try block? Since after catching the error would be a failure
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.
This file needs to be formatted with the Biome configuration
| setResendDisabled(false) | ||
| throw error | ||
| } | ||
| onSave?.() |
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.
Should also probably be at the bottom of the try block instead of after catching
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.
Same issue with onSave being after catching the error instead of inside the try block. Not sure if that's intentional. onSave should probably only be called after a success
|
I can merge this once the above comments are resolved |
This pull request introduces enhancements to the settings components by adding an
onSavecallback prop across multiple components. This allows developers to execute custom logic after successful updates (e.g., email, password, username changes). Additionally, it includes documentation updates and minor code formatting improvements.Enhancements to Component Functionality:
onSavecallback prop to the following components:UpdateFieldCard,UpdateNameCard,UpdateUsernameCard,ChangeEmailCard, andChangePasswordCard. This prop allows custom logic to be executed after successful updates, such as closing dialogs or refreshing user data. ([[1]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-5c8cd3d988f41f9f4eead8739b070e61dd934b7d3060a7258aec41438d0a408cL41-R42),[[2]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-5c8cd3d988f41f9f4eead8739b070e61dd934b7d3060a7258aec41438d0a408cL56-R58),[[3]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-5c8cd3d988f41f9f4eead8739b070e61dd934b7d3060a7258aec41438d0a408cR155-R162),[[4]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-759e5215377903309c11507d36bf32fa9c5c9e9d472376e498eb516ac242b052R12),[[5]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-759e5215377903309c11507d36bf32fa9c5c9e9d472376e498eb516ac242b052R37),[[6]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-b1f75c01668212152ba2d42254614cef7965a03015a9003985b96af5e411eb35L1-R18),[[7]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-b1f75c01668212152ba2d42254614cef7965a03015a9003985b96af5e411eb35R32-R35),[[8]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-ef8f2bd0f57af21e02524cac14c291c6bd5885872d73b7ba202828bd98609641R26),[[9]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-ef8f2bd0f57af21e02524cac14c291c6bd5885872d73b7ba202828bd98609641R123-R137),[[10]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-ef8f2bd0f57af21e02524cac14c291c6bd5885872d73b7ba202828bd98609641L182-R194),[[11]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-023b3910db4d4eee4bb9f1d45234ebfee80845ca6c5671e093238081879edd0fR36),[[12]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-023b3910db4d4eee4bb9f1d45234ebfee80845ca6c5671e093238081879edd0fL45-R47),[[13]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-023b3910db4d4eee4bb9f1d45234ebfee80845ca6c5671e093238081879edd0fR171-R185),[[14]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-023b3910db4d4eee4bb9f1d45234ebfee80845ca6c5671e093238081879edd0fL188-R201),[[15]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-159fb75f86ec54f3e7bfbb8b782f4b954874e7172e4fe24c18f3ea928131d9cbR56))Documentation Updates:
ChangeEmailCard,ChangePasswordCard, andUpdateUsernameCardto include examples of using theonSaveprop, showcasing its utility in scenarios like closing dialogs or redirecting users. ([[1]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-86a580f849eaa3135d3b75ae4225aeb6d8476a9db8d4e267a4daaa0bf57fef45L63-R103),[[2]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-5cf061453caea01fdaa17113d0a268bb24a57b36671ee3687a4366239c88c2f6L75-R117),[[3]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-4f7a92974e45c7eb250065986be3bac17a28a07648b14106948d914c0f004eb9R46-R76))ChangeEmailCardandChangePasswordCardto enhance readability. ([[1]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-86a580f849eaa3135d3b75ae4225aeb6d8476a9db8d4e267a4daaa0bf57fef45L7-R30),[[2]](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-5cf061453caea01fdaa17113d0a268bb24a57b36671ee3687a4366239c88c2f6L7-R30))Code Formatting Improvements:
UpdateUsernameCardfor consistent code style. ([src/components/settings/account/update-username-card.tsxL1-R18](https://github.com/daveyplate/better-auth-ui/pull/121/files#diff-b1f75c01668212152ba2d42254614cef7965a03015a9003985b96af5e411eb35L1-R18))