From cac0a9858e05026eaeb4fe72dcb49072e31b8797 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Mon, 23 Sep 2024 16:48:28 +0100 Subject: [PATCH] refactor: drop use of loader --- packages/site/src/components/Navigation/Search.tsx | 1 - themes/article/app/utils/loaders.server.ts | 7 ------- themes/book/app/utils/loaders.server.ts | 9 --------- 3 files changed, 17 deletions(-) diff --git a/packages/site/src/components/Navigation/Search.tsx b/packages/site/src/components/Navigation/Search.tsx index 6df705e92..29cf610a4 100644 --- a/packages/site/src/components/Navigation/Search.tsx +++ b/packages/site/src/components/Navigation/Search.tsx @@ -380,7 +380,6 @@ function SearchForm({ const timeoutId = setTimeout(() => { if (query != undefined && !!doSearch) { doSearch(query).then((rawResults) => { - console.log({ rawResults }); setSearchResults( rawResults && rankAndFilterResults(rawResults) diff --git a/themes/article/app/utils/loaders.server.ts b/themes/article/app/utils/loaders.server.ts index fca278055..bf9ab3063 100644 --- a/themes/article/app/utils/loaders.server.ts +++ b/themes/article/app/utils/loaders.server.ts @@ -89,13 +89,6 @@ export async function getMystXrefJson(): Promise | null> { return xrefs; } -export async function getMystSearchJson(): Promise | null> { - const url = updateLink('/myst.search.json'); - const response = await fetch(url).catch(() => null); - if (!response || response.status === 404) return null; - return await response.json(); -} - export async function getFavicon(): Promise<{ contentType: string | null; buffer: Buffer } | null> { const config = await getConfig(); const url = updateLink(config.options?.favicon) || 'https://mystmd.org/favicon.ico'; diff --git a/themes/book/app/utils/loaders.server.ts b/themes/book/app/utils/loaders.server.ts index bacda3996..502827d87 100644 --- a/themes/book/app/utils/loaders.server.ts +++ b/themes/book/app/utils/loaders.server.ts @@ -9,7 +9,6 @@ import { } from '@myst-theme/common'; import { redirect } from '@remix-run/node'; import { responseNoArticle, responseNoSite, getDomainFromRequest } from '@myst-theme/site'; -import type { MystSearchIndex } from '@myst-theme/search'; const CONTENT_CDN_PORT = process.env.CONTENT_CDN_PORT ?? '3100'; const CONTENT_CDN = `http://localhost:${CONTENT_CDN_PORT}`; @@ -90,14 +89,6 @@ export async function getMystXrefJson(): Promise | null> { return xrefs; } -export async function getMystSearchJson(): Promise { - const url = updateLink('/myst.search.json'); - console.log("REQUESTING SEARCH", url) - const response = await fetch(url).catch(() => null); - if (!response || response.status === 404) return null; - return await response.json(); -} - export async function getFavicon(): Promise<{ contentType: string | null; buffer: Buffer } | null> { const config = await getConfig(); const url = updateLink(config.options?.favicon) || 'https://mystmd.org/favicon.ico';