@@ -17,17 +17,17 @@ import { proposedChangedState } from "@/state/atoms/proposedChanges.atom";
1717import { constructPath } from "@/utils/fetch" ;
1818import { Icon } from "@iconify-icon/react" ;
1919import { useAtom } from "jotai" ;
20- import { Link , Navigate , useLocation , useParams } from "react-router-dom" ;
20+ import { Link , useLocation , useParams } from "react-router-dom" ;
2121import { StringParam , useQueryParam } from "use-query-params" ;
2222import LoadingScreen from "@/screens/loading-screen/loading-screen" ;
2323import { ProposedChangesChecksTab } from "@/screens/proposed-changes/checks-tab" ;
2424import { ProposedChangeDetails } from "@/screens/proposed-changes/proposed-change-details" ;
25- import { NetworkStatus } from "@apollo/client" ;
2625import { CoreProposedChange } from "@/generated/graphql" ;
2726import { Badge } from "@/components/ui/badge" ;
2827import { getObjectDetailsUrl } from "@/utils/objects" ;
2928import { ObjectHelpButton } from "@/components/menu/object-help-button" ;
3029import { useSchema } from "@/hooks/useSchema" ;
30+ import NoDataFound from "@/screens/errors/no-data-found" ;
3131
3232export const PROPOSED_CHANGES_TABS = {
3333 CONVERSATIONS : "conversations" ,
@@ -105,30 +105,19 @@ export function Component() {
105105 const { proposedChangeId } = useParams ( ) ;
106106 const { schema } = useSchema ( PROPOSED_CHANGES_OBJECT ) ;
107107
108- const { loading, networkStatus, error, data, client } = useQuery ( GET_PROPOSED_CHANGE_DETAILS , {
109- notifyOnNetworkStatusChange : true ,
108+ const { loading, error, data, client } = useQuery ( GET_PROPOSED_CHANGE_DETAILS , {
110109 variables : {
111110 id : proposedChangeId ,
112111 nodeId : proposedChangeId , // Used for tasks, which is a different type
113112 } ,
114113 } ) ;
115114
116- if ( networkStatus === NetworkStatus . loading ) {
115+ if ( loading ) {
117116 return < LoadingScreen className = "m-auto h-auto" /> ;
118117 }
119118
120- if ( error ) {
121- return (
122- < ErrorScreen message = "Something went wrong when fetching the proposed changes details." />
123- ) ;
124- }
125-
126119 const proposedChangesData = data ?. [ PROPOSED_CHANGES_OBJECT ] ?. edges ?. [ 0 ] ?. node ;
127120
128- if ( ! proposedChangesData ) {
129- return < Navigate to = { constructPath ( "/proposed-changes" ) } /> ;
130- }
131-
132121 const tabs = [
133122 {
134123 label : "Overview" ,
@@ -162,6 +151,37 @@ export function Component() {
162151 } ,
163152 ] ;
164153
154+ if ( error || ! proposedChangesData ) {
155+ return (
156+ < Content >
157+ < Content . Title
158+ title = {
159+ < div className = "flex items-center gap-2" >
160+ < Link
161+ className = "no-underline hover:underline"
162+ to = { constructPath ( "/proposed-changes" ) } >
163+ Proposed changes
164+ </ Link >
165+ </ div >
166+ }
167+ reload = { ( ) => client . reFetchObservableQueries ( ) }
168+ isReloadLoading = { loading } >
169+ < ObjectHelpButton
170+ documentationUrl = { schema ?. documentation }
171+ kind = { PROPOSED_CHANGES_OBJECT }
172+ className = "ml-auto"
173+ />
174+ </ Content . Title >
175+
176+ { error && (
177+ < ErrorScreen message = "Something went wrong when fetching the proposed changes details." />
178+ ) }
179+
180+ { ! proposedChangesData && < NoDataFound message = "No proposed changes found." /> }
181+ </ Content >
182+ ) ;
183+ }
184+
165185 return (
166186 < Content >
167187 < Content . Title
0 commit comments