From 36461d81cd0821c952bcfdcaeaddd65f17585d90 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Tue, 17 Mar 2026 14:11:53 -0700 Subject: [PATCH 1/2] fix(DB): add Mongo recommended index --- server/models/supporticketmessage.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/server/models/supporticketmessage.ts b/server/models/supporticketmessage.ts index 4dda619e5..ff4d53167 100644 --- a/server/models/supporticketmessage.ts +++ b/server/models/supporticketmessage.ts @@ -67,6 +67,7 @@ SupportTicketMessageSchema.virtual("sender", { }); SupportTicketMessageSchema.index({ uuid: 1 }); +SupportTicketMessageSchema.index({ ticket: 1, type: 1, createdAt: -1 }); SupportTicketMessageSchema.set("toObject", { virtuals: true }); SupportTicketMessageSchema.set("toJSON", { virtuals: true }); From 1602563602b3bc4bdb069df54f3be93b34ffea96 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Tue, 17 Mar 2026 15:11:22 -0700 Subject: [PATCH 2/2] fix(Search): remove projects lookup from authors search and fix pagination iss --- .../src/components/commons/CommonsCatalog.tsx | 16 ++++++++----- .../CatalogCard/AuthorCardContent.tsx | 24 ++----------------- .../CommonsCatalog/CatalogCard/index.tsx | 4 ++-- .../CommonsCatalog/DetailModal/index.tsx | 4 ++-- .../commons/CommonsCatalog/VisualMode.tsx | 6 ++--- client/src/context/CatalogContext.tsx | 4 ++-- client/src/types/Search.ts | 5 +--- server/api/search.ts | 3 --- 8 files changed, 22 insertions(+), 44 deletions(-) diff --git a/client/src/components/commons/CommonsCatalog.tsx b/client/src/components/commons/CommonsCatalog.tsx index b050e1727..b35945158 100644 --- a/client/src/components/commons/CommonsCatalog.tsx +++ b/client/src/components/commons/CommonsCatalog.tsx @@ -486,6 +486,16 @@ const CommonsCatalog = () => { return; } + // Authors and minirepos always use React Query (no browse endpoints) + if (activeTab === "authors") { + authorsSearch.fetchNextPage(); + return; + } + if (activeTab === "minirepos") { + miniReposSearch.fetchNextPage(); + return; + } + // In search mode, use React Query's fetchNextPage if (isSearchMode) { switch (activeTab) { @@ -498,12 +508,6 @@ const CommonsCatalog = () => { case "projects": if (isProjectsSearchMode) projectsSearch.fetchNextPage(); break; - case "authors": - authorsSearch.fetchNextPage(); - break; - case "minirepos": - miniReposSearch.fetchNextPage(); - break; } } else { // In browse mode, manually load more with incremented page diff --git a/client/src/components/commons/CommonsCatalog/CatalogCard/AuthorCardContent.tsx b/client/src/components/commons/CommonsCatalog/CatalogCard/AuthorCardContent.tsx index 40c608324..3934e80c8 100644 --- a/client/src/components/commons/CommonsCatalog/CatalogCard/AuthorCardContent.tsx +++ b/client/src/components/commons/CommonsCatalog/CatalogCard/AuthorCardContent.tsx @@ -1,11 +1,11 @@ import { Card, CardContentProps, CardHeader } from "semantic-ui-react"; -import { ConductorSearchResponseAuthor } from "../../../../types"; +import { Author } from "../../../../types"; import { truncateString } from "../../../util/HelperFunctions"; import { useMemo } from "react"; import CardMetaWIcon from "../../../util/CardMetaWIcon"; interface AuthorCardContentProps extends CardContentProps { - author: ConductorSearchResponseAuthor; + author: Author; } const AuthorCardContent: React.FC = ({ @@ -29,26 +29,6 @@ const AuthorCardContent: React.FC = ({
{truncateString(author.companyName || author.programName || "", 50)}
)} - {author.projects?.length > 0 && ( - - - - )} {author.nameURL && (
diff --git a/client/src/components/commons/CommonsCatalog/CatalogCard/index.tsx b/client/src/components/commons/CommonsCatalog/CatalogCard/index.tsx index 75e8fb07d..65645282d 100644 --- a/client/src/components/commons/CommonsCatalog/CatalogCard/index.tsx +++ b/client/src/components/commons/CommonsCatalog/CatalogCard/index.tsx @@ -2,7 +2,7 @@ import { Link } from "react-router-dom"; import { Card, CardProps } from "semantic-ui-react"; import { Book, - ConductorSearchResponseAuthor, + Author, ConductorSearchResponseFile, Project, } from "../../../../types"; @@ -18,7 +18,7 @@ interface CatalogCardProps extends CardProps { | Book | ConductorSearchResponseFile | Project - | ConductorSearchResponseAuthor; + | Author; onDetailClick?: () => void; } diff --git a/client/src/components/commons/CommonsCatalog/DetailModal/index.tsx b/client/src/components/commons/CommonsCatalog/DetailModal/index.tsx index bdf229f65..60da8f890 100644 --- a/client/src/components/commons/CommonsCatalog/DetailModal/index.tsx +++ b/client/src/components/commons/CommonsCatalog/DetailModal/index.tsx @@ -1,7 +1,7 @@ import { Modal } from "semantic-ui-react"; import { Book, - ConductorSearchResponseAuthor, + Author, ConductorSearchResponseFile, Project, } from "../../../../types"; @@ -12,7 +12,7 @@ interface DetailModalProps { | Book | ConductorSearchResponseFile | Project - | ConductorSearchResponseAuthor; + | Author; open: boolean; onClose: () => void; } diff --git a/client/src/components/commons/CommonsCatalog/VisualMode.tsx b/client/src/components/commons/CommonsCatalog/VisualMode.tsx index 578a1225c..36d97572c 100644 --- a/client/src/components/commons/CommonsCatalog/VisualMode.tsx +++ b/client/src/components/commons/CommonsCatalog/VisualMode.tsx @@ -1,6 +1,6 @@ import { Book, - ConductorSearchResponseAuthor, + Author, ConductorSearchResponseFile, Project, } from "../../../types"; @@ -19,7 +19,7 @@ const VisualMode = ({ | Book | ConductorSearchResponseFile | Project - | ConductorSearchResponseAuthor + | Author )[]; loading?: boolean; noResultsMessage?: string; @@ -29,7 +29,7 @@ const VisualMode = ({ | Book | ConductorSearchResponseFile | Project - | ConductorSearchResponseAuthor + | Author | undefined >(undefined); diff --git a/client/src/context/CatalogContext.tsx b/client/src/context/CatalogContext.tsx index 9175f42a4..4fc0553a6 100644 --- a/client/src/context/CatalogContext.tsx +++ b/client/src/context/CatalogContext.tsx @@ -5,7 +5,7 @@ import type { Book, BookFilters, CommonsModule, - ConductorSearchResponseAuthor, + Author, ConductorSearchResponseFile, Project, ProjectFilters, @@ -51,7 +51,7 @@ export interface CatalogContextValue { miniRepos: CatalogEntityData; // Authors entity - authors: CatalogEntityData; + authors: CatalogEntityData; // Stop loading trigger (for infinite scroll) triggerStopLoading: () => void; diff --git a/client/src/types/Search.ts b/client/src/types/Search.ts index 62b2cf420..7d5f4beba 100644 --- a/client/src/types/Search.ts +++ b/client/src/types/Search.ts @@ -88,9 +88,6 @@ export type UserSearchParams = { sort?: "first" | "last"; } & _commonSearchParams; -export type ConductorSearchResponseAuthor = Author & { - projects: Pick[]; -}; export type ConductorSearchResponseFile = ProjectFileWProjectData< "title" | "thumbnail" | "description" | "projectURL" >; @@ -112,7 +109,7 @@ export type ConductorSearchResponse< : T extends "users" ? User[] : T extends "authors" - ? ConductorSearchResponseAuthor[] + ? Author[] : T extends "minirepos" ? Project[] : never; diff --git a/server/api/search.ts b/server/api/search.ts index 7237eeb3e..21b015421 100644 --- a/server/api/search.ts +++ b/server/api/search.ts @@ -28,7 +28,6 @@ import Author from "../models/author.js"; import Fuse from "fuse.js"; import Organization from "../models/organization.js"; import AssetTagFramework from "../models/assettagframework.js"; -import authorsAPI from "./authors.js"; import SearchQuery, { SearchQueryInterface_Raw, } from "../models/searchquery.js"; @@ -37,7 +36,6 @@ import { _getBookPublicOrInstructorAssetsCount, buildOrganizationNamesList } fro import CustomCatalog, { CustomCatalogInterface } from "../models/customcatalog.js"; import { normalizedSort } from "../util/searchutils.js"; import SearchService from "./services/search-service.js"; -import AuthorService from "./services/author-service.js"; const searchQueryCache: SearchQueryInterface_Raw[] = []; // in-memory cache for search queries @@ -1892,7 +1890,6 @@ async function authorsSearch( nameKey: { $exists: true, $ne: null }, }, }, - AuthorService.LOOKUP_AUTHOR_PROJECTS_STAGE, { $project: { userUUID: 0,