Fix: Link path not recognised in CommandPalette link extensions (#108162)

* fix(extensions-ui): commandpalette links should work with urls / paths

* fix(commandpalette): block navigation if url exists before calling perform
This commit is contained in:
Jack Westbrook
2025-07-17 08:03:39 +02:00
committed by GitHub
parent c7aa83f8d3
commit 0d2657e2f0
2 changed files with 5 additions and 1 deletions
@@ -121,6 +121,10 @@ export const KBarResults = (props: KBarResultsProps) => {
const url = (item as ActionImpl & { url?: string }).url;
if (item.command) {
if (url) {
// If the item also has a url we should block navigation.
ev.preventDefault();
}
item.command.perform(item);
// TODO: ideally the perform method would return some marker or we would have something like preventDefault()
if (!item.id.startsWith('scopes/') || item.id === 'scopes/apply') {
@@ -22,8 +22,8 @@ export default function useExtensionActions(): CommandPaletteAction[] {
priority: EXTENSIONS_PRIORITY,
id: link.id,
name: link.title,
target: link.path,
perform: () => link.onClick && link.onClick(),
url: link.path,
}));
}, [links]);
}