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:
@@ -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]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user