Prevent losing commands with context (#254)

This commit is contained in:
Evgenii Karagodin
2023-01-04 16:37:09 +01:00
committed by GitHub
parent c3d5f4275e
commit 66eb289d6e
3 changed files with 22 additions and 12 deletions
+2 -10
View File
@@ -63,25 +63,17 @@ export default function reducer(
};
}
case "show-palette": {
const commands = new Map(state.commands);
for (const [k, v] of state.commands.entries()) {
if (
v.command.contexts &&
(!action.context || !v.command.contexts.includes(action.context))
) {
commands.delete(k);
}
}
return {
...state,
commands,
showCommandPalette: true,
showCommandPaletteContext: action.context,
};
}
case "hide-palette":
return {
...state,
showCommandPalette: false,
showCommandPaletteContext: undefined,
};
case "command-run":
return {