Reduce React Doctor diagnostics in FilesView (#1271)

* Reduce React Doctor diagnostics in FilesView

* fix: address Greptile review feedback — use Base UI initialFocus and restore useMemo for displayedContent

- Replace useEffect-based dialog focus with Base UI Popup's initialFocus
  prop to avoid race with built-in focus management
- Drop unused no-op onOpenAutoFocus/onCloseAutoFocus from dialog wrapper
- Restore useMemo for displayedContent (200K char slice) to avoid
  per-render string allocation for large files
- Update DirectoryExplorerDialog to use initialFocus={false}
This commit is contained in:
Bohdan Triapitsyn
2026-05-17 23:31:28 +03:00
committed by GitHub
parent 6369cf76a7
commit 2290cf4b59
3 changed files with 189 additions and 158 deletions
@@ -707,7 +707,7 @@ export const DirectoryExplorerDialog: React.FC<DirectoryExplorerDialogProps> = (
<Dialog open={open} onOpenChange={onOpenChange}>
<DialogContent
className="flex w-full max-w-xl flex-col gap-0 overflow-hidden p-0 sm:max-h-[80vh]"
onOpenAutoFocus={(event) => event.preventDefault()}
initialFocus={false}
>
<DialogHeader className="px-5 pb-2 pt-5">
<div className="flex items-start justify-between gap-4">