chainlit
chainlit copied to clipboard
fix: Cancel button in Chat settings dialog not working properly
trafficstars
Issue
Cancel button behavior: Previously, clicking the "Cancel" button would incorrectly save the settings changes, behaving the same as the "Confirm" button. This was not the expected behavior. Console warning:
[Warning] Warning: Missing `Description` or `aria-describedby={undefined}` for {DialogContent}. (chunk-WOIZ637Z.js, line 340)
Changes Made
- Fixed the Cancel button behavior to revert to the last saved settings instead of saving the changes
- Added setChatSettingsValue to maintain local state
- Ensured consistent behavior when closing the dialog through different methods (Cancel button, X button, clicking outside)
- add DialogDescription to resolve accessibility warning
Technical Details
- Imported required Recoil state management tools
- Added proper handling of chatSettingsValue
- Updated handleClose function to reset to last saved values (not default values)
- Ensured handleConfirm synchronizes local state when saving settings
Testing procedure
- Modify settings and save, verify new values are correctly saved
- Modify any settings without saving, close dialog through different methods (Cancel, X, click outside), verify it reverts to last saved values
- Reset settings to default values, click cancel, verify it reverts to last saved values
- Reset settings to default values again and save, verify all revert to default values