Repository navigation
Conversation
[Low impact] The PR appears safe to merge; the approved file list now stays fixed during confirmation. SummaryReplace All now asks for confirmation and keeps the approved file list fixed.
The previous finding is fixed: results arriving during confirmation no longer expand the files being replaced. No new actionable issues were found. Reviews (3) · Last reviewed commit: "fix(search): only replace files that wer..." · Reviewed by Greptile |
f1db4fa to
9229ae3
Compare
results kept coming in while the dialog was open, so replace all could touch files that weren't in the count
9229ae3 to
88a3ce9
Compare
| if (files.length) { | ||
| const confirmed = await confirm( | ||
| strings.warning, | ||
| strings["replace all confirm"] | ||
| .replace("{matches}", resultOverview.matchesCount) | ||
| .replace("{files}", files.length), | ||
| ); | ||
| if (!confirmed) return; |
There was a problem hiding this comment.
Minor edge case: replacing is still false while the dialog is open, so a refresh / add-folder / remove-folder event from files can still run onInput in that window. It clears the results and schedules a new search 500ms later. If the user then taps OK, that search can be sent to the same workers doing the replace, and its done-searching calls terminateWorker(false), which can cut the replace short.
Bailing out if the search changed while the dialog was open would close this:
| if (files.length) { | |
| const confirmed = await confirm( | |
| strings.warning, | |
| strings["replace all confirm"] | |
| .replace("{matches}", resultOverview.matchesCount) | |
| .replace("{files}", files.length), | |
| ); | |
| if (!confirmed) return; | |
| if (files.length) { | |
| const version = searchVersion; | |
| const confirmed = await confirm( | |
| strings.warning, | |
| strings["replace all confirm"] | |
| .replace("{matches}", resultOverview.matchesCount) | |
| .replace("{files}", files.length), | |
| ); | |
| if (!confirmed || version !== searchVersion) return; |
Closes #3045
Replace All in Search in files now shows a confirm dialog first, e.g. "Replace 12 matches in 3 files?". If you cancel, nothing changes and the running search isn't stopped.
replace all confirmstring to all lang files (English text for now) and toindex.d.tsI haven't built the APK for this one, so I couldn't try it on a device yet.