Skip to content

refactor: duplicated tiles and table logic - #1819

Merged
JammingBen merged 8 commits into
mainfrom
refactor/duplicated-tiles-table-logic
Jan 15, 2026
Merged

JammingBen merged 8 commits into
mainfrom
refactor/duplicated-tiles-table-logic

Conversation

@JammingBen

@JammingBen JammingBen commented Jan 13, 2026 •

Copy link
Copy Markdown
Member
  • removes duplicated logic for tiles and table view and puts them into shared composables
  • removes unused mounted hooks in tile and table views
  • removes the targetRouteCallback because it only introduces unnecessary overhead. the only edge case where this made any sense is on the trash overview page, which can be solved via a simple active route query.

closes #1518

@JammingBen JammingBen self-assigned this Jan 13, 2026
@JammingBen JammingBen added the Type:Maintenance E.g. technical debt, packaging, etc. label Jan 13, 2026
@JammingBen JammingBen changed the title Refactor/duplicated tiles table logic refactor: duplicated tiles and table logic Jan 13, 2026
@JammingBen
JammingBen force-pushed the refactor/duplicated-tiles-table-logic branch 2 times, most recently from de3b0ca to f9c6e6a Compare January 14, 2026 12:37
@JammingBen
JammingBen force-pushed the refactor/duplicated-tiles-table-logic branch from f9c6e6a to 73489e3 Compare January 15, 2026 10:04
@JammingBen
JammingBen marked this pull request as ready for review January 15, 2026 10:25
Copilot AI review requested due to automatic review settings January 15, 2026 10:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors duplicated logic between ResourceTiles and ResourceTable components by extracting shared functionality into composables. The changes consolidate selection handling, context menu logic, and resource link generation into reusable composables, remove unused mounted hooks, and eliminate the targetRouteCallback prop which was causing unnecessary overhead.

Changes:

  • Extracts shared selection, context menu, and helper logic into useResourceViewSelection, useResourceViewContextMenu, and updates to useResourceViewHelpers composables
  • Removes targetRouteCallback prop and related logic, replacing it with direct route checks
  • Removes unused rowMounted event emissions and related refs in both tile and table views

Reviewed changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/web-pkg/src/composables/resources/useResourceViewSelection.ts New composable extracting shared selection logic for resource views
packages/web-pkg/src/composables/resources/useResourceViewContextMenu.ts New composable extracting shared context menu logic for resource views
packages/web-pkg/src/composables/resources/useResourceViewHelpers.ts Updated to integrate new composables and add shared helper methods
packages/web-pkg/src/components/FilesList/ResourceTiles.vue Refactored to use shared composables, removed duplicated logic and unused mounted hooks
packages/web-pkg/src/components/FilesList/ResourceTable.vue Refactored to use shared composables, removed duplicated logic and unused mounted hooks
packages/web-pkg/src/composables/filesList/useResourceRouteResolver.ts Replaced targetRouteCallback with direct route check using isLocationTrashActive
packages/web-pkg/src/helpers/contextMenuDropdown.ts Updated to accept HTMLElement in addition to ComponentPublicInstance
packages/web-pkg/tests/unit/components/FilesList/ResourceTiles.spec.ts Added mock for getElementById to support context menu tests
packages/web-pkg/tests/unit/components/FilesList/ResourceTable.spec.ts Updated test setup to support new composable structure and added deleteQueue parameter
packages/web-pkg/src/helpers/folderLink/types.ts Deleted file as CreateTargetRouteOptions type is no longer needed
packages/web-app-files/src/views/trash/Overview.vue Removed targetRouteCallback prop usage
packages/web-app-files/src/views/spaces/GenericSpace.vue Removed targetRouteCallback prop and related logic
packages/web-app-files/src/components/Shares/SharedWithMeSection.vue Removed targetRouteCallback prop and related logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@JammingBen
JammingBen requested a review from kulmann January 15, 2026 10:45

@kulmann kulmann 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.

🥇

@JammingBen
JammingBen merged commit d4155ee into main Jan 15, 2026
1 check passed
@JammingBen
JammingBen deleted the refactor/duplicated-tiles-table-logic branch January 15, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type:Maintenance E.g. technical debt, packaging, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extract duplicated logic in files table and tiles view

3 participants