From d1cf01061bf74978d2dad6c41ac27968baa74f28 Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Sun, 25 Jun 2023 10:43:58 -0400 Subject: [PATCH 1/3] fix error on prod --- src/server/handlers/theme-handler.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/server/handlers/theme-handler.ts b/src/server/handlers/theme-handler.ts index b107d854..eb0c8ce4 100644 --- a/src/server/handlers/theme-handler.ts +++ b/src/server/handlers/theme-handler.ts @@ -11,8 +11,7 @@ export default async (req: Request, res: Response) => { const theme = req.params.name; if (!theme.endsWith(".css")) { - res.statusCode = 400; - res.send("Theme must be a css file"); + return res.status(400).send("Theme must be a css file"); } const customTheme = path.resolve(extraThemesFolder, theme); From 9938ac6ee454ea539f9a3a5ad3d8a005942daafd Mon Sep 17 00:00:00 2001 From: Alec Armbruster <35377827+alectrocute@users.noreply.github.com> Date: Sun, 25 Jun 2023 10:47:21 -0400 Subject: [PATCH 2/3] fix lint error --- src/server/handlers/theme-handler.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/server/handlers/theme-handler.ts b/src/server/handlers/theme-handler.ts index eb0c8ce4..456fb3bd 100644 --- a/src/server/handlers/theme-handler.ts +++ b/src/server/handlers/theme-handler.ts @@ -17,15 +17,15 @@ export default async (req: Request, res: Response) => { const customTheme = path.resolve(extraThemesFolder, theme); if (existsSync(customTheme)) { - res.sendFile(customTheme); + return res.sendFile(customTheme); } else { const internalTheme = path.resolve(`./dist/assets/css/themes/${theme}`); // If the theme doesn't exist, just send litely if (existsSync(internalTheme)) { - res.sendFile(internalTheme); + return res.sendFile(internalTheme); } else { - res.sendFile(path.resolve("./dist/assets/css/themes/litely.css")); + return res.sendFile(path.resolve("./dist/assets/css/themes/litely.css")); } } }; From 25cab15cfa489da4161d098fb491573efd8ffaf6 Mon Sep 17 00:00:00 2001 From: SleeplessOne1917 Date: Sun, 25 Jun 2023 13:07:18 -0400 Subject: [PATCH 3/3] Fix search request being called twice on search page --- src/shared/components/search.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/shared/components/search.tsx b/src/shared/components/search.tsx index 473b18c4..b58580e5 100644 --- a/src/shared/components/search.tsx +++ b/src/shared/components/search.tsx @@ -332,7 +332,9 @@ export class Search extends Component { } async componentDidMount() { - if (!this.state.isIsomorphic) { + if ( + !(this.state.isIsomorphic || this.props.history.location.state?.searched) + ) { const promises = [this.fetchCommunities()]; if (this.state.searchText) { promises.push(this.search()); @@ -1095,7 +1097,9 @@ export class Search extends Component { sort: sort ?? urlSort, }; - this.props.history.push(`/search${getQueryString(queryParams)}`); + this.props.history.push(`/search${getQueryString(queryParams)}`, { + searched: true, + }); await this.search(); }