Skip to content

[PB-5819]: feature/auto-restore items#1955

Open
xabg2 wants to merge 12 commits into
masterfrom
refactor/move-items
Open

[PB-5819]: feature/auto-restore items#1955
xabg2 wants to merge 12 commits into
masterfrom
refactor/move-items

Conversation

@xabg2
Copy link
Copy Markdown
Contributor

@xabg2 xabg2 commented May 11, 2026

Description

Adding the logic to auto restore items if the parent folder exists. If to, then the "Move items" dialog is opened to select the destination of the items.

Related Issues

Related Pull Requests

Checklist

  • Changes have been tested locally.
  • Unit tests have been written or updated as necessary.
  • The code adheres to the repository's coding standards.
  • Relevant documentation has been added or updated.
  • No new warnings or errors have been introduced.
  • SonarCloud issues have been reviewed and addressed.
  • QA Passed

Testing Process

Additional Notes

@xabg2 xabg2 self-assigned this May 11, 2026
@xabg2 xabg2 added the enhancement New feature or request label May 11, 2026
@xabg2 xabg2 changed the base branch from master to feature/trash-redesign May 11, 2026 12:11
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 11, 2026

Deploying drive-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: efaea00
Status: ✅  Deploy successful!
Preview URL: https://66d4eeac.drive-web.pages.dev
Branch Preview URL: https://refactor-move-items.drive-web.pages.dev

View logs

Base automatically changed from feature/trash-redesign to master May 11, 2026 14:08
@xabg2 xabg2 marked this pull request as ready for review May 12, 2026 07:13
@xabg2 xabg2 requested review from CandelR and larryrider as code owners May 12, 2026 07:13
CandelR
CandelR previously approved these changes May 13, 2026
Comment thread src/hooks/moveItems/useMoveItems.ts Outdated
Comment on lines +106 to +111
await Promise.all(
restorable.map((item) => {
dispatch(storageActions.setMoveDestinationFolderId(item.parent?.uuid as string));
return processMove({ finalDestinationId: item.parent!.uuid, items: [item] });
}),
);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

there is a race condition here as setMoveDestinationFolderId is overwritten in every call, anyway, as processMove receives de finalDestinationId is no need to set setMoveDestinationFolderId i think.
Maybe we can add a test for this case :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep. But I noticed that the moveDestinationFolderId is used when there are conflicts with the file in the folder we want to move in. destinationFolderId is used for "Name Collision".

Let me think another way so we can avoid the race condition here.

Comment thread src/hooks/moveItems/useMoveItems.ts Outdated
const dispatch = useAppDispatch();
const itemsToMove: DriveItemData[] = useSelector((state: RootState) => state.storage.itemsToMove);
const processMove = async ({ finalDestinationId, items, displayTaskLogger }: ProcessMoveProps) => {
const processItems = items ?? itemsToMove;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

as items is a required field is no need itemsToMove fallback

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Indeed

@xabg2 xabg2 requested a review from CandelR May 13, 2026 11:01
@sonarqubecloud
Copy link
Copy Markdown

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants