Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix: command k tab cycle hard crash (#407)

gbirmanf9bc72959b9d
diff --git a/js/app/packages/app/component/SoupContext.tsx b/js/app/packages/app/component/SoupContext.tsx
index 8d01ee5435..d1af00cb17 100644
--- a/js/app/packages/app/component/SoupContext.tsx
+++ b/js/app/packages/app/component/SoupContext.tsx
@@ -1015,7 +1015,7 @@ export function createNavigationEntityListShortcut({
if (hasSelection) {
setKonsoleMode('SELECTION_MODIFICATION');
- const selectionIndex = searchCategories.getCateoryIndex('Selection');
+ const selectionIndex = searchCategories.getCategoryIndex('Selection');
if (selectionIndex === undefined) return false;
diff --git a/js/app/packages/app/component/UnifiedListView.tsx b/js/app/packages/app/component/UnifiedListView.tsx
index f1a1ada5f4..b63be7d4c0 100644
--- a/js/app/packages/app/component/UnifiedListView.tsx
+++ b/js/app/packages/app/component/UnifiedListView.tsx
@@ -1628,7 +1628,7 @@ export function UnifiedListView(props: UnifiedListViewProps) {
if (hasSelection) {
setKonsoleMode('SELECTION_MODIFICATION');
const selectionIndex =
- searchCategories.getCateoryIndex('Selection');
+ searchCategories.getCategoryIndex('Selection');
if (selectionIndex === undefined) return false;
diff --git a/js/app/packages/app/component/command/Konsole.tsx b/js/app/packages/app/component/command/Konsole.tsx
index da98e4a061..430acb90d8 100644
--- a/js/app/packages/app/component/command/Konsole.tsx
+++ b/js/app/packages/app/component/command/Konsole.tsx
@@ -232,19 +232,19 @@ export function KommandMenuInner(props: {
];
};
+ const isFullTextSearch = createMemo(
+ () => currentKonsoleMode() === 'FULL_TEXT_SEARCH'
+ );
+
// choose which items to display, based on which menu is open
const filteredItems = createMemo(() => {
- if (currentKonsoleMode() === 'FULL_TEXT_SEARCH')
- return ([] as CommandItemCard[])
- .concat(paginatedSearch.items())
- .concat(loadMoreItem())
- .map((item: CommandItemCard) => hydrateChannel(item, channelLookup()))
- .filter((item: CommandItemCard) => {
- return filterItemByCategory(item);
- });
- return searchItems().filter((item: CommandItemCard) => {
- return filterItemByCategory(item);
- });
+ if (isFullTextSearch()) {
+ return [...paginatedSearch.items(), ...loadMoreItem()]
+ .map((item) => hydrateChannel(item, channelLookup()))
+ .filter(filterItemByCategory);
+ }
+
+ return searchItems().filter(filterItemByCategory);
});
const itemAction = useCommandItemAction({ setCommandScopeCommands });
diff --git a/js/app/packages/app/component/command/KonsoleItem.tsx b/js/app/packages/app/component/command/KonsoleItem.tsx
index 3eb6093063..5b9365dee9 100644
--- a/js/app/packages/app/component/command/KonsoleItem.tsx
+++ b/js/app/packages/app/component/command/KonsoleItem.tsx
@@ -116,12 +116,12 @@ type KonsoleCategory = {
visible: boolean;
};
-const [categories, setCategories] = createStore<KonsoleCategory[]>(
- DEFAULT_CATEGORIES.slice()
-);
+const [categories, setCategories] = createStore<KonsoleCategory[]>([
+ ...DEFAULT_CATEGORIES,
+]);
export const searchCategories = {
- getCateoryIndex(name: DefaultCategoryNames | (string & {})) {
+ getCategoryIndex(name: DefaultCategoryNames | (string & {})) {
const index = categories.findIndex((c) => c.name === name);
if (index === -1) return;
@@ -160,7 +160,7 @@ export const searchCategories = {
},
findNextCategoryIndex(category: number, backwards: boolean): number {
let candidateCategory = -1;
- const length = categories.length;
+ const length = this.listVisible().length;
for (let i = 1; i < length; i++) {
if (backwards) {
candidateCategory = category - i;
@@ -446,7 +446,7 @@ function getCommandItemBlockName(
}
function getCommandItemName(item: CommandItemCard): string {
- return item.data.name!;
+ return item.data.name;
}
export function filterItemByCategory(item: CommandItemCard) {