From 46d38aa53fa925a2335fdf6c3b0b6f47d05dce94 Mon Sep 17 00:00:00 2001 From: Lena Date: Tue, 2 Mar 2021 20:15:39 +0100 Subject: [PATCH] Route instead of Redirect from empty bug to 404 after a hint from GM #10 --- return-404-page.patch | 37 ++++++++++++++++++++++++++++++++ webui/src/App.tsx | 1 - webui/src/pages/bug/BugQuery.tsx | 6 ++++-- 3 files changed, 41 insertions(+), 3 deletions(-) create mode 100644 return-404-page.patch diff --git a/return-404-page.patch b/return-404-page.patch new file mode 100644 index 00000000..e512d622 --- /dev/null +++ b/return-404-page.patch @@ -0,0 +1,37 @@ +diff --git a/webui/src/App.tsx b/webui/src/App.tsx +index 3e8f71e..4fd0993 100644 +--- a/webui/src/App.tsx ++++ b/webui/src/App.tsx +@@ -11,7 +11,6 @@ export default function App() { + + + +- + + + +diff --git a/webui/src/pages/bug/BugQuery.tsx b/webui/src/pages/bug/BugQuery.tsx +index ade64e9..5d459c4 100644 +--- a/webui/src/pages/bug/BugQuery.tsx ++++ b/webui/src/pages/bug/BugQuery.tsx +@@ -1,8 +1,10 @@ + import React from 'react'; +-import { Redirect, RouteComponentProps } from 'react-router-dom'; ++import { RouteComponentProps } from 'react-router-dom'; + + import CircularProgress from '@material-ui/core/CircularProgress'; + ++import NotFoundPage from '../notfound/NotFoundPage'; ++ + import Bug from './Bug'; + import { useGetBugQuery } from './BugQuery.generated'; + +@@ -15,7 +17,7 @@ const BugQuery: React.FC = ({ match }: Props) => { + variables: { id: match.params.id }, + }); + if (loading) return ; +- if (!data?.repository?.bug) return ; ++ if (!data?.repository?.bug) return ; + if (error) return

Error: {error}

; + return ; + }; diff --git a/webui/src/App.tsx b/webui/src/App.tsx index e0580b1d..4c81913c 100644 --- a/webui/src/App.tsx +++ b/webui/src/App.tsx @@ -13,7 +13,6 @@ export default function App() { - diff --git a/webui/src/pages/bug/BugQuery.tsx b/webui/src/pages/bug/BugQuery.tsx index ade64e9d..5d459c42 100644 --- a/webui/src/pages/bug/BugQuery.tsx +++ b/webui/src/pages/bug/BugQuery.tsx @@ -1,8 +1,10 @@ import React from 'react'; -import { Redirect, RouteComponentProps } from 'react-router-dom'; +import { RouteComponentProps } from 'react-router-dom'; import CircularProgress from '@material-ui/core/CircularProgress'; +import NotFoundPage from '../notfound/NotFoundPage'; + import Bug from './Bug'; import { useGetBugQuery } from './BugQuery.generated'; @@ -15,7 +17,7 @@ const BugQuery: React.FC = ({ match }: Props) => { variables: { id: match.params.id }, }); if (loading) return ; - if (!data?.repository?.bug) return ; + if (!data?.repository?.bug) return ; if (error) return

Error: {error}

; return ; };