Skip to content

Feature/8 move multi selection processing to backend#302

Open
connykaelinvisol wants to merge 2 commits intoFlowpack:2.x-devfrom
connykaelinvisol:feature/8-move-multi-selection-processing-to-backend
Open

Feature/8 move multi selection processing to backend#302
connykaelinvisol wants to merge 2 commits intoFlowpack:2.x-devfrom
connykaelinvisol:feature/8-move-multi-selection-processing-to-backend

Conversation

@connykaelinvisol
Copy link
Copy Markdown
Contributor

What I did
Added backend support for batch asset mutations (delete, tag, untag, assign collection, update) so that multi-selection operations are processed in a single GraphQL request instead of sending individual mutations per asset from the frontend. Additionally, standardized all single-asset mutations to return MutationResult instead of a mix of Asset and MutationResult, and extracted shared validation logic into reusable helper methods.

How I did it (main changes and additional fixes)
Backend:

  • Added resolveAsset() and resolveTag() helper methods to AssetMutator to eliminate duplicated asset/tag resolution and validation logic across 9+ methods
  • Standardized updateAsset, tagAsset, untagAsset, and setAssetTags to return MutationResult instead of ?Asset — aligning them with deleteAsset, setAssetCollections, and editAsset which already used this pattern
  • Added 5 batch mutation methods to AssetMutator: deleteAssets, tagAssets, untagAssets, assignAssetsToCollection, updateAssets — each iterates server-side with per-asset error handling
  • Renamed AssetIdentities::$collections to $identities to fix a misleading property name
  • Added a TYPE_ALIASES mapping in Resolver.php to handle the irregular plural AssetIdentity → AssetIdentities (the resolver's default pluralization appends 's', producing AssetIdentitys which doesn't match)

Frontend:

  • Created 5 new GraphQL mutation definitions (deleteAssets, tagAssets, untagAssets, assignAssetsToCollection, updateAssets) and 5 new hooks (useDeleteAssets, useTagAssets, useUntagAssets, useAssignAssetsToCollection, useUpdateAssets)
  • Updated 4 existing single-asset mutation definitions (updateAsset, tagAsset, untagAsset, setAssetTags) to request { success messages } instead of ...AssetProps and 4 existing hooks (useUpdateAsset, useSetAssetTags, useTagAsset, useUntagAssetById) to handle MutationResult responses with refetchQueries instead of optimistic responses
  • Added getFailedAssetLabelsFromResults to useFailedAssetLabels for mapping batch results to failed asset labels
  • Updated DeleteAssetButton, TagSelectBoxMulti, CollectionSelectBox, and PropertyInspector to use the batch hooks instead of Promise.allSettled with individual mutations

* Move processing of multi selection actions to the backend.
* Generalize action response with MutationResult.
* Use helper function for Asset and Tag resolvement.
@connykaelinvisol
Copy link
Copy Markdown
Contributor Author

Within my work on this feature I noticed that there is a response handling mix for the single asset actions. I therefore standardized it to use MutationResult in every action. Even though this requires an additional refetchQueries I think the performance loss is neglectable (and quite low). The upside is a more consistent result handling.

@connykaelinvisol connykaelinvisol force-pushed the feature/8-move-multi-selection-processing-to-backend branch from 0fa5d5c to 2b77c5b Compare April 25, 2026 17:47
@connykaelinvisol connykaelinvisol force-pushed the feature/8-move-multi-selection-processing-to-backend branch from 2b77c5b to 5f7e709 Compare April 25, 2026 17:54
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.

1 participant