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.
This commit is contained in:
Ahmed Awan
2025-10-29 12:57:07 -05:00
parent 0065aa6075
commit 9a8e6322d1
2 changed files with 14 additions and 2 deletions
@@ -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() {
+10 -1
View File
@@ -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) {