fix(folder-picker): show loading state to fix dead clicks on repo selector#2473
fix(folder-picker): show loading state to fix dead clicks on repo selector#2473adboio wants to merge 1 commit into
Conversation
Generated-By: PostHog Code Task-Id: e6034585-4d15-44f5-acdb-20fc8c001a07
|
| const [isOpening, setIsOpening] = useState(false); | ||
|
|
||
| const handleSelect = (path: string) => { |
There was a problem hiding this comment.
The string
"Opening..." is spelled out twice — once in fieldContent and once in compactContent — violating the OnceAndOnlyOnce simplicity rule. Extracting it to a constant makes any future copy change a single edit.
| const [isOpening, setIsOpening] = useState(false); | |
| const handleSelect = (path: string) => { | |
| const [isOpening, setIsOpening] = useState(false); | |
| const openingLabel = "Opening..."; | |
| const handleSelect = (path: string) => { |
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/code/src/renderer/features/folder-picker/components/FolderPicker.tsx
Line: 53-55
Comment:
The string `"Opening..."` is spelled out twice — once in `fieldContent` and once in `compactContent` — violating the OnceAndOnlyOnce simplicity rule. Extracting it to a constant makes any future copy change a single edit.
```suggestion
const [isOpening, setIsOpening] = useState(false);
const openingLabel = "Opening...";
const handleSelect = (path: string) => {
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Problem
Clicking the folder/repo selector opens a native directory picker dialog, but the UI gave no synchronous feedback while the dialog was open. Because no DOM mutation occurred on click, PostHog logged these as "dead clicks." Users also had no indication that the picker was opening.
Changes
isOpeningstate toFolderPickerthat is set synchronously when the picker is triggered and cleared in afinallyblock once the native dialog resolves or errors.fieldandcompactvariants.CaretDownicon for an animatedCircleNotchspinner.aria-busyto prevent re-clicks and improve accessibility.handleOpenFilePickerto ignore re-clicks while a dialog is already open.FolderPicker.test.tsxcovering:The synchronous state change both reassures the user and gives PostHog a DOM mutation so the open native dialog is no longer recorded as a dead click.
How did you test this?
Automatic notifications
Created with PostHog Code