Add ts interface for RouterPushOptions for better typing

Fixes vue-tsc issues related to DatasetDisplay improvements.
This commit is contained in:
Dannon Baker
2025-07-29 16:38:16 -04:00
parent e7dc06c48e
commit e634402a05
2 changed files with 22 additions and 7 deletions
@@ -9,11 +9,11 @@ import {
faSpinner,
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { getGalaxyInstance } from "app";
import { BBadge, BButton, BCollapse } from "bootstrap-vue";
import { computed, ref } from "vue";
import { useRoute, useRouter } from "vue-router/composables";
import { getGalaxyInstance } from "@/app";
import type { ItemUrls } from "@/components/History/Content/Dataset/index";
import { updateContentFields } from "@/components/History/model/queries";
import { useEntryPointStore } from "@/stores/entryPointStore";
@@ -22,6 +22,7 @@ import { clearDrag } from "@/utils/setDrag";
import { JobStateSummary } from "./Collection/JobStateSummary";
import { getContentItemState, type StateMap, STATES } from "./model/states";
import type { RouterPushOptions } from "./router-push-options";
import CollectionDescription from "./Collection/CollectionDescription.vue";
import ContentOptions from "./ContentOptions.vue";
@@ -277,18 +278,20 @@ function onDisplay() {
// but we're using a __vkey__ bit as a workaround
// Only conditionally force to keep urls clean most of the time.
if (route.path === itemUrls.value.display) {
// @ts-ignore - monkeypatched router, drop with migration.
router.push(displayUrl, {
const options: RouterPushOptions = {
force: true,
preventWindowManager: !isWindowManagerActive,
title: isWindowManagerActive ? `${props.item.hid}: ${props.name}` : undefined,
});
} else if (displayUrl) {
};
// @ts-ignore - monkeypatched router, drop with migration.
router.push(displayUrl, {
router.push(displayUrl, options);
} else if (displayUrl) {
const options: RouterPushOptions = {
preventWindowManager: !isWindowManagerActive,
title: isWindowManagerActive ? `${props.item.hid}: ${props.name}` : undefined,
});
};
// @ts-ignore - monkeypatched router, drop with migration.
router.push(displayUrl, options);
}
}
}
@@ -0,0 +1,12 @@
/**
* Custom options for the monkeypatched router.push() method
* Used to control window manager behavior and force navigation
*/
export interface RouterPushOptions {
// Title for window manager frame
title?: string;
// Force reload (currently by adding timestamp to URL)
force?: boolean;
// Explicit WM bypass -- prevent opening in window manager even if active
preventWindowManager?: boolean;
}