fix(dashboard): browse panel follows a newly created folder in project setup
selectCreatedDirectory set the input value but left the panel on the PARENT directory, whose footer Select button commits currentPath — the natural next click overwrote the just-created folder with its parent. Navigate the panel into the created directory so input, panel, and Select agree. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
7
.changeset/dirpicker-select-created-folder.md
Normal file
7
.changeset/dirpicker-select-created-folder.md
Normal file
@@ -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."
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user