Skip to content

fix: resolve nested path creation from parent listings#1935

Merged
bajrangCoder merged 3 commits intoAcode-Foundation:mainfrom
bajrangCoder:ix/create-file-structure-nested-paths
Mar 9, 2026
Merged

fix: resolve nested path creation from parent listings#1935
bajrangCoder merged 3 commits intoAcode-Foundation:mainfrom
bajrangCoder:ix/create-file-structure-nested-paths

Conversation

@bajrangCoder
Copy link
Copy Markdown
Member

Fixes: #1745

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 9, 2026

Greptile Summary

This PR refactors createFileStructure in helpers.js to unify path creation logic across all storage types using an ensureEntry helper, and updates openFolder.js to detect nested paths and trigger a full folder reload instead of individual tile appends.

Key strengths:

  • Proper error handling: createNew is wrapped in try/catch/finally so stopLoading() is always called and errors surface via helpers.error()
  • Nested-path detection correctly triggers reload() + FileList.refresh() for multi-segment paths

Critical regression:
When a single-segment path references an existing entry with matching type (e.g., trying to create a file that already exists), the refactored ensureEntry returns a valid object with created: false. The guard at line 676 (if (!newUrl) return;) no longer catches this case, allowing the code to proceed and append the existing entry as a duplicate tile to the expanded folder view, along with a misleading success toast. This is a breaking change from the previous behavior where undefined was returned and the caller exited early.

Confidence Score: 2/5

  • Not safe to merge as-is — a logic regression silently adds duplicate entries to the folder UI when attempting to create a same-named file or folder that already exists.
  • The regression identified is a real functional bug that breaks expected behavior for a common use case (user attempts to create a file/folder with a name that already exists in the current folder). The fix is straightforward (check newUrl.created before appending) but the issue must be resolved before merging.
  • src/lib/openFolder.js — the duplicate-appending regression must be fixed by checking newUrl.created in the guard at line 676.

Last reviewed commit: a6cc83f

@bajrangCoder
Copy link
Copy Markdown
Member Author

@greptileai review it again

@bajrangCoder bajrangCoder merged commit cc7c385 into Acode-Foundation:main Mar 9, 2026
6 checks passed
@bajrangCoder bajrangCoder deleted the ix/create-file-structure-nested-paths branch March 9, 2026 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

createFileStructure does not pass file/folder intent to fsOperation.extend stat

1 participant