[6.x] Lazy-load actions for assets, collections, submissions & terms#14097
Open
duncanmcclean wants to merge 2 commits into6.xfrom
Open
[6.x] Lazy-load actions for assets, collections, submissions & terms#14097duncanmcclean wants to merge 2 commits into6.xfrom
duncanmcclean wants to merge 2 commits into6.xfrom
Conversation
jasonvarga
requested changes
Mar 4, 2026
Member
jasonvarga
left a comment
There was a problem hiding this comment.
Changes via AI review, but confirmed with my browser, eyes, and mouse:
The direction (lazy-load actions for assets, collections, submissions, terms) is good and matches the entry listing. Submissions and terms are safe because they use prepended row actions and the shared Listing with actionUrl/actionContext. Collections are safe with actions_url.
The asset browser is not yet compatible with omitting actions:
- Guard against undefined
actionsinAssetBrowserMixin.js(and any other asset browser code that touchesfolder.actions/asset.actions), e.g. optional chaining:asset.actions?.some(...),folder.actions?.some(...), and equivalent for.find()and.length. Ensure drag/drop and “move” behaviour degrade safely when actions are not yet loaded (or add a path to load them before enabling move). - Table view – folder row actions: Either show the folder actions dropdown when
actionUrl/context exist (e.g. show whenfolderActionUrlis set, and passundefinedfor:actionssoItemActionslazy-loads on hover), or ensureloadActionsis triggered when the user opens the folder actions menu so the dropdown can populate. - Grid view: Ensure folder and asset context menus (or dropdowns) either trigger
loadActionswhen opened or handleactionsbeing undefined without throwing (e.g. avoidasset.actions.lengthwhenactionsmay be undefined).
Until the asset browser is updated along these lines, removing actions from FolderAsset (and any asset list payload) will introduce regressions and possible JS errors.
Suggested Changes
- Blocking: In
AssetBrowserMixin.js, use optional chaining (or equivalent) whereverasset.actionsorfolder.actionsis used (e.g.canMoveAsset,canMoveFolder,handleFolderDrop), so missingactionsdoes not throw. Decide how move/drag should behave when actions are not loaded (e.g. disable until loaded, or trigger load on first interaction). - Blocking: In
Table.vue, change folder row actions so the dropdown is shown when folder actions can be lazy-loaded (e.g. whenfolderActionUrlis set), and pass:actions="folder.actions"(soundefinedtriggers lazy-load inItemActions). Add a way to triggerloadActionson dropdown/menu open (e.g.@mouseoveror equivalent) so actions appear. - Blocking: In
Grid.vue, fix any direct use ofasset.actions(e.g.asset.actions.length) so it is safe whenactionsis undefined; ensure folder/asset menus can triggerloadActionswhen opened so lazy-loaded actions appear.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request avoids sending
actionsfrom the server, in favour of lazy-loading them over AJAX when the dropdown is hovered over.We already do this in the entry listing by just not passing the
actionskey, so I've copied that over to other places where it makes sense.