diff --git a/.changeset/dirpicker-select-created-folder.md b/.changeset/dirpicker-select-created-folder.md new file mode 100644 index 0000000000..1fb6ee7d23 --- /dev/null +++ b/.changeset/dirpicker-select-created-folder.md @@ -0,0 +1,7 @@ +--- +"@runfusion/fusion": patch +--- + +summary: Creating a new folder in project setup now selects it fully — the browser panel follows the created folder so Select confirms it. +category: fix +dev: "DirectoryPicker: with selectCreatedDirectory, handleCreateFolder now navigates the browse panel into the created directory instead of refreshing the parent; the footer Select button commits browser.currentPath, so staying on the parent let the next click overwrite the auto-selected new folder." diff --git a/packages/dashboard/app/components/DirectoryPicker.tsx b/packages/dashboard/app/components/DirectoryPicker.tsx index 893664f50d..429bbc4138 100644 --- a/packages/dashboard/app/components/DirectoryPicker.tsx +++ b/packages/dashboard/app/components/DirectoryPicker.tsx @@ -147,12 +147,18 @@ export function DirectoryPicker({ value, onChange, placeholder, onInputKeyDown, FNXC:DirectoryPicker 2026-07-03-00:00: Project setup must select the directory returned by createDirectory immediately after folder creation so first-time users do not accidentally register the parent directory. Keep this opt-in because DirectoryPicker is shared by non-project surfaces such as plugin installation. + + FNXC:DirectoryPicker 2026-07-18-02:50: + Setting the input value alone was not enough: the browse panel stayed on the PARENT directory, and its footer Select button commits browser.currentPath — so the natural next click overwrote the just-created folder with its parent (field report: "creating a new folder doesn't select it"). + When selectCreatedDirectory is on, navigate the panel INTO the created folder so the input, the panel, and the Select button all agree on the new directory. */ if (selectCreatedDirectory) { onChange(result.path); + await fetchEntries(result.path, browser.showHidden); + } else { + // Refresh entries to show the new folder + await fetchEntries(browser.currentPath, browser.showHidden); } - // Refresh entries to show the new folder - await fetchEntries(browser.currentPath, browser.showHidden); } catch (err) { setBrowser((prev) => ({ ...prev, diff --git a/packages/dashboard/app/components/__tests__/DirectoryPicker.test.tsx b/packages/dashboard/app/components/__tests__/DirectoryPicker.test.tsx index fec6bce643..900f9288e8 100644 --- a/packages/dashboard/app/components/__tests__/DirectoryPicker.test.tsx +++ b/packages/dashboard/app/components/__tests__/DirectoryPicker.test.tsx @@ -348,8 +348,19 @@ describe("DirectoryPicker", () => { expect(onChange).toHaveBeenCalledWith("/normalized/home/user/Fresh Project"); }); expect(mockCreateDirectory).toHaveBeenCalledWith("/home/user/fresh-project"); + /* + FNXC:DirectoryPicker 2026-07-18-02:50: + The panel must navigate INTO the created folder (not refresh the parent): + the footer Select button commits browser.currentPath, so staying on the + parent let the next click overwrite the auto-selected new folder. + */ await waitFor(() => { - expect(mockBrowseDirectory).toHaveBeenLastCalledWith("/home/user", false, undefined, undefined); + expect(mockBrowseDirectory).toHaveBeenLastCalledWith( + "/normalized/home/user/Fresh Project", + false, + undefined, + undefined, + ); }); });