From 41e55dff857320aea69781c92b23bf6e02de8dbc Mon Sep 17 00:00:00 2001
From: guru_sainath
Date: Mon, 21 Aug 2023 12:43:41 +0530
Subject: [PATCH] fix: build error for 404 and search params null check (#1919)
---
.../[workspace_slug]/[project_slug]/page.tsx | 3 ++-
apps/space/lib/mobx/store-init.tsx | 9 ---------
apps/space/{app/404/page.tsx => pages/404.tsx} | 0
apps/space/pages/_app.tsx | 10 ++++++++++
apps/space/pages/_document.tsx | 17 +++++++++++++++++
5 files changed, 29 insertions(+), 10 deletions(-)
rename apps/space/{app/404/page.tsx => pages/404.tsx} (100%)
create mode 100644 apps/space/pages/_app.tsx
create mode 100644 apps/space/pages/_document.tsx
diff --git a/apps/space/app/[workspace_slug]/[project_slug]/page.tsx b/apps/space/app/[workspace_slug]/[project_slug]/page.tsx
index f6ccf5081..80dd5f038 100644
--- a/apps/space/app/[workspace_slug]/[project_slug]/page.tsx
+++ b/apps/space/app/[workspace_slug]/[project_slug]/page.tsx
@@ -25,7 +25,8 @@ const WorkspaceProjectPage = observer(() => {
const routerSearchparams = useSearchParams();
const { workspace_slug, project_slug } = routerParams as { workspace_slug: string; project_slug: string };
- const board = routerSearchparams.get("board") as TIssueBoardKeys | "";
+ const board =
+ routerSearchparams && routerSearchparams.get("board") != null && (routerSearchparams.get("board") as TIssueBoardKeys | "");
// updating default board view when we are in the issues page
useEffect(() => {
diff --git a/apps/space/lib/mobx/store-init.tsx b/apps/space/lib/mobx/store-init.tsx
index 4f4b6662c..a31bc822f 100644
--- a/apps/space/lib/mobx/store-init.tsx
+++ b/apps/space/lib/mobx/store-init.tsx
@@ -1,10 +1,6 @@
"use client";
import { useEffect } from "react";
-// next imports
-import { useSearchParams } from "next/navigation";
-// interface
-import { TIssueBoardKeys } from "store/types";
// mobx store
import { useMobxStore } from "lib/mobx/store-provider";
import { RootStore } from "store/root";
@@ -12,11 +8,6 @@ import { RootStore } from "store/root";
const MobxStoreInit = () => {
const store: RootStore = useMobxStore();
- // search params
- const routerSearchparams = useSearchParams();
-
- const board = routerSearchparams.get("board") as TIssueBoardKeys;
-
useEffect(() => {
// theme
const _theme = localStorage && localStorage.getItem("app_theme") ? localStorage.getItem("app_theme") : "light";
diff --git a/apps/space/app/404/page.tsx b/apps/space/pages/404.tsx
similarity index 100%
rename from apps/space/app/404/page.tsx
rename to apps/space/pages/404.tsx
diff --git a/apps/space/pages/_app.tsx b/apps/space/pages/_app.tsx
new file mode 100644
index 000000000..8681006e1
--- /dev/null
+++ b/apps/space/pages/_app.tsx
@@ -0,0 +1,10 @@
+// styles
+import "styles/globals.css";
+// types
+import type { AppProps } from "next/app";
+
+function MyApp({ Component, pageProps }: AppProps) {
+ return ;
+}
+
+export default MyApp;
diff --git a/apps/space/pages/_document.tsx b/apps/space/pages/_document.tsx
new file mode 100644
index 000000000..8b41d05fc
--- /dev/null
+++ b/apps/space/pages/_document.tsx
@@ -0,0 +1,17 @@
+import Document, { Html, Head, Main, NextScript } from "next/document";
+
+class MyDocument extends Document {
+ render() {
+ return (
+
+
+
+
+
+
+
+ );
+ }
+}
+
+export default MyDocument;