Skip to content

[PB-6531]: extract name collision move actions out of the container - #2146

Open
terrerox wants to merge 2 commits into
masterfrom
refactor/extract-name-collision-move-actions
Open

terrerox wants to merge 2 commits into
masterfrom
refactor/extract-name-collision-move-actions

Conversation

@terrerox

Copy link
Copy Markdown
Contributor

Description

First of a stack that ends in #2039 (skip option) and #2129 (merge folders on skip). Pure refactor, no behaviour change.

The name-collision container held every side effect inline. This moves the move-collision handling (keep both with a unique name, replace by trashing the existing item) into nameCollision.actions.ts behind resolveMoveCollision, which takes the items plus a small context (dispatch, workspace, upload limit, versioning flag) instead of closing over component state. Upload collisions stay in the container for now and move in the next PR.

Unit tests cover both move resolutions.

Related Issues

Related Pull Requests

  • Next: refactor/extract-name-collision-upload-actions

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

yarn vitest run src/app/drive/components/NameCollisionDialog, plus the manual upload/move collision flows (keep both, replace, with and without versioning).

Move the keep/replace handling for moved items into nameCollision.actions
behind resolveMoveCollision, with unit tests. No behaviour change.
@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying drive-web with  Cloudflare Pages  Cloudflare Pages

Latest commit: 7407a2c
Status: ✅  Deploy successful!
Preview URL: https://239b54f9.drive-web.pages.dev
Branch Preview URL: https://refactor-extract-name-collis-twf5.drive-web.pages.dev

View logs

@terrerox terrerox self-assigned this Sep 11, 2026
@terrerox
terrerox added this pull request to stack #2149 September 11, 2026 04:06
@terrerox
terrerox removed this pull request from stack #2149 September 11, 2026 05:41
@terrerox
terrerox added this pull request to stack #2151 September 11, 2026 05:44
Comment on lines +38 to +39
const resolve = (params: Omit<ResolveMoveCollisionParams, 'destinationUuid'>) =>
resolveMoveCollision({ ...params, destinationUuid: DESTINATION }, getContext());

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.

the context is created inside resolve, so the tests never get hold of dispatch. They check that moveItemsThunk and popItemsToDelete are called, but not that their results are dispatched. If the dispatch(...) wrapper is dropped in nameCollision.actions.ts, both tests still pass while nothing is actually moved or removed from the pending list.

@sonarqubecloud

Copy link
Copy Markdown

@terrerox
terrerox requested a review from CandelR September 15, 2026 02:56
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.

2 participants