Commit 6ae1cb0
authored
fix: defer provider name trimming to submission time (#12903)
### What this PR does
Before this PR:
- Provider name input was trimmed on every keystroke during typing
- Users couldn't type spaces between words without them being
immediately removed
- Button disabled state checked raw name length
After this PR:
- Provider name input preserves spaces during typing
- Name is trimmed only when submitting (both `onOk` and `onClose`)
- Button disabled state correctly checks trimmed name length
- Improved UX while maintaining data integrity
Fixes #
### Why we need it and why it was done in this way
This improves the user experience by allowing natural typing behavior.
Users can now type spaces between words (e.g., "My Provider") without
the spaces being immediately stripped.
The following tradeoffs were made:
- Trade-off: Users can now see leading/trailing spaces in the input
field during typing, but this is acceptable as the final value is
properly trimmed on submission
The following alternatives were considered:
- Trimming only leading/trailing spaces on input: This would be more
complex and still interfere with natural typing
- Not trimming at all: This would allow invalid provider names with
whitespace
Links to places where the discussion took place:
N/A
### Breaking changes
None. This is a pure UX improvement with no API or data model changes.
### Special notes for your reviewer
- The change ensures both `onOk` (submit) and `onClose` paths trim the
name
- The `buttonDisabled` logic now correctly checks if the trimmed name is
empty
- No changes to data models or IndexedDB schema
### Checklist
This checklist is not enforcing, but it's a reminder of items that could
be relevant to every PR.
Approvers are expected to review this list.
- [x] PR: The PR description is expressive enough and will help future
contributors
- [x] Code: [Write code that humans can
understand](https://en.wikiquote.org/wiki/Martin_Fowler#code-for-humans)
and [Keep it simple](https://en.wikipedia.org/wiki/KISS_principle)
- [x] Refactor: You have [left the code cleaner than you found it (Boy
Scout
Rule)](https://learning.oreilly.com/library/view/97-things-every/9780596809515/ch08.html)
- [x] Upgrade: Impact of this change on upgrade flows was considered and
addressed if required
- [x] Documentation: A [user-guide update](https://docs.cherry-ai.com)
was considered and is present (link) or not required. You want a
user-guide update if it's a user facing feature.
### Release note
```release-note
Improved provider name input UX by allowing spaces during typing. Names are now trimmed only on submission.
```1 parent 746a26f commit 6ae1cb0
File tree
1 file changed
+4
-4
lines changed- src/renderer/src/pages/settings/ProviderSettings
1 file changed
+4
-4
lines changedLines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| |||
0 commit comments