Skip to content

fix: address 2 bugs from Devin Review on workspaceStore#8

Merged
Huynhthuongg merged 1 commit into
mainfrom
devin/1777470850-fix-devin-review-pr4
Apr 29, 2026
Merged

fix: address 2 bugs from Devin Review on workspaceStore#8
Huynhthuongg merged 1 commit into
mainfrom
devin/1777470850-fix-devin-review-pr4

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Fixes 2 bugs identified by Devin Review (PR #4) in src/stores/workspaceStore.ts:

  1. updateChildrenPaths uses String.replace() which incorrectly matches substrings
    child.path.replace(oldPath, newPath) only replaces the first occurrence and can match mid-path substrings (e.g. renaming /src would corrupt /src2/file). Fixed by using startsWith() + slice() to only replace the path prefix.

  2. duplicateFile doesn't deep-clone children when duplicating folders
    Spreading ...node copies the children array by reference, so duplicated folders share the same child objects with identical id and path values. Added a deepCloneFileNode helper that recursively creates new IDs and correct paths for all descendants.

Review & Testing Checklist for Human

  • Rename a folder that has a sibling folder whose name starts with the same prefix (e.g. rename utils when utils-extra exists) — verify utils-extra children are unaffected
  • Duplicate a folder with nested subfolders — verify all children have unique IDs and paths under the new copy
  • Verify existing file tree operations (create, delete, move) still work correctly

Notes

Lint (npm run lint) and typecheck (tsc -b) both pass.

Link to Devin session: https://app.devin.ai/sessions/8da679d231384b9f8006427ea1372f8a
Requested by: @Huynhthuongg

- Fix updateChildrenPaths: use startsWith+slice instead of String.replace()
  to prevent incorrect substring matching when renaming files/folders
- Fix duplicateFile: deep-clone children with new IDs and paths when
  duplicating folders to avoid shared references

Co-Authored-By: Thuong Huynh <admin@huynhthuong.online>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@Huynhthuongg Huynhthuongg marked this pull request as ready for review April 29, 2026 15:14
@Huynhthuongg Huynhthuongg merged commit ef4cf25 into main Apr 29, 2026
1 of 2 checks passed

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

Open in Devin Review

Comment thread src/stores/workspaceStore.ts
Comment thread src/stores/workspaceStore.ts
@Huynhthuongg Huynhthuongg self-requested a review April 30, 2026 09:21

@Huynhthuongg Huynhthuongg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

@Huynhthuongg Huynhthuongg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/

@Huynhthuongg Huynhthuongg added bug Something isn't working documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed invalid This doesn't seem right question Further information is requested labels Jun 18, 2026
@Huynhthuongg Huynhthuongg self-requested a review June 18, 2026 03:44

@Huynhthuongg Huynhthuongg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed invalid This doesn't seem right question Further information is requested

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant