chainlit icon indicating copy to clipboard operation
chainlit copied to clipboard

fix: Cancel button in Chat settings dialog not working properly

Open hexart opened this issue 9 months ago • 0 comments
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

  1. Imported required Recoil state management tools
  2. Added proper handling of chatSettingsValue
  3. Updated handleClose function to reset to last saved values (not default values)
  4. Ensured handleConfirm synchronizes local state when saving settings

Testing procedure

  1. Modify settings and save, verify new values are correctly saved
  2. Modify any settings without saving, close dialog through different methods (Cancel, X, click outside), verify it reverts to last saved values
  3. Reset settings to default values, click cancel, verify it reverts to last saved values
  4. Reset settings to default values again and save, verify all revert to default values

hexart avatar Feb 14 '25 16:02 hexart