lobe-chat
lobe-chat copied to clipboard
đ fix: user feedback for empty/long group names in create/edit group modals
đť ĺć´çąťĺ | Change Type
- [ ] ⨠feat
- [x] đ fix
- [ ] âťď¸ refactor
- [ ] đ style
- [ ] đˇ build
- [ ] âĄď¸ perf
- [ ] đ docs
- [ ] đ¨ chore
đ ĺć´čŻ´ć | Description of Change
To show an alert when the user submits an empty or long group name in Create Group and Rename Group Modals.
đ 襼ĺ äżĄćŻ | Additional Information
- Removed the below
if
block in CreateModal
onOk={async (e: MouseEvent<HTMLButtonElement>) => {
if (!input) return;
To allow the input length check that shows an alert if the title does not meet the criteria.
- Removed the below
if
block in RenameGroupModal
onOk={async (e: MouseEvent<HTMLButtonElement>) => {
if (!input) return;
To allow the input length check that shows an alert if the title does not meet the criteria.
2.1 And this forced to ensure types are valid for input
state variable, as a result input
state is initialized to '' (empty string - following the same convention in CreateGroupModal)
const [input, setInput] = useState<string>('');
2.2 Added fallback to empty string in the onCancel
, in case the group.name is empty.
onCancel={(e) => {
setInput(group?.name ?? '');
onCancel?.(e);
}}