From 9a8e6322d17b8c16d0f58727f52b06cafca0e651 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Wed, 29 Oct 2025 12:57:07 -0500 Subject: [PATCH] force push to router so collection builder can be invoked consecutively Same concept as in https://github.com/galaxyproject/galaxy/blob/9821f60d0054ff16dddcf2dfe794ebd5db83714e/client/src/components/History/Content/ContentItem.vue#L236-L246. Hopefully vue-router 4 will help us replace these workarounds with its native force push. --- .../HistoryOperations/SelectionOperations.vue | 5 ++++- client/src/entry/analysis/router-push.js | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/client/src/components/History/CurrentHistory/HistoryOperations/SelectionOperations.vue b/client/src/components/History/CurrentHistory/HistoryOperations/SelectionOperations.vue index c45db08edd6..0724b5bf3d7 100644 --- a/client/src/components/History/CurrentHistory/HistoryOperations/SelectionOperations.vue +++ b/client/src/components/History/CurrentHistory/HistoryOperations/SelectionOperations.vue @@ -303,7 +303,10 @@ export default { const { setSelectedItems } = useCollectionBuilderItemSelection(); const selection = Array.from(this.contentSelection.values()); setSelectedItems(selection); - this.$router.push({ path: `/collection/new_list?advanced=${advanced}` }); + + // vue-router 4 supports a native force push with clean URLs, but we're using a __vkey__ + // bit as a workaround to allow the builder to be invoked consecutively + this.$router.push({ path: `/collection/new_list?advanced=${advanced}` }, { force: true }); }, // Selected content manipulation, hide/show/delete/purge hideSelected() { diff --git a/client/src/entry/analysis/router-push.js b/client/src/entry/analysis/router-push.js index e75f3f6d975..802709b3aac 100644 --- a/client/src/entry/analysis/router-push.js +++ b/client/src/entry/analysis/router-push.js @@ -15,7 +15,16 @@ export function patchRouterPush(VueRouter) { // add key to location to force component refresh const { title, force, preventWindowManager } = options; if (force) { - location = addSearchParams(location, { __vkey__: Date.now() }); + // since location can either be string or object, we need to pass the string url to addSearchParams + if (typeof location === "string") { + location = addSearchParams(location, { __vkey__: Date.now() }); + } else if (typeof location === "object") { + // convert to string version addSearchParams can handle + let url = this.resolve(location).href; + url = addSearchParams(url, { __vkey__: Date.now() }); + // convert back to object version + location = this.resolve(url).route; + } } // verify if confirmation is required if (this.confirmation) {