fix: build error for 404 and search params null check (#1919)

This commit is contained in:
guru_sainath 2023-08-21 12:43:41 +05:30 committed by GitHub
parent 0bccb63a9f
commit 41e55dff85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 10 deletions

View File

@ -25,7 +25,8 @@ const WorkspaceProjectPage = observer(() => {
const routerSearchparams = useSearchParams(); const routerSearchparams = useSearchParams();
const { workspace_slug, project_slug } = routerParams as { workspace_slug: string; project_slug: string }; 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 // updating default board view when we are in the issues page
useEffect(() => { useEffect(() => {

View File

@ -1,10 +1,6 @@
"use client"; "use client";
import { useEffect } from "react"; import { useEffect } from "react";
// next imports
import { useSearchParams } from "next/navigation";
// interface
import { TIssueBoardKeys } from "store/types";
// mobx store // mobx store
import { useMobxStore } from "lib/mobx/store-provider"; import { useMobxStore } from "lib/mobx/store-provider";
import { RootStore } from "store/root"; import { RootStore } from "store/root";
@ -12,11 +8,6 @@ import { RootStore } from "store/root";
const MobxStoreInit = () => { const MobxStoreInit = () => {
const store: RootStore = useMobxStore(); const store: RootStore = useMobxStore();
// search params
const routerSearchparams = useSearchParams();
const board = routerSearchparams.get("board") as TIssueBoardKeys;
useEffect(() => { useEffect(() => {
// theme // theme
const _theme = localStorage && localStorage.getItem("app_theme") ? localStorage.getItem("app_theme") : "light"; const _theme = localStorage && localStorage.getItem("app_theme") ? localStorage.getItem("app_theme") : "light";

10
apps/space/pages/_app.tsx Normal file
View File

@ -0,0 +1,10 @@
// styles
import "styles/globals.css";
// types
import type { AppProps } from "next/app";
function MyApp({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}
export default MyApp;

View File

@ -0,0 +1,17 @@
import Document, { Html, Head, Main, NextScript } from "next/document";
class MyDocument extends Document {
render() {
return (
<Html>
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}
export default MyDocument;