Skip to content

Commit 7dd688d

Browse files
fix: Navigation between CAP Operator UrIs (kyma-project#4295)
* Check if resource is already loaded * Checking data and waiting with error * Correct delay
1 parent 3902ce1 commit 7dd688d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/shared/components/ResourceDetails/ResourceDetails.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import { useAtomValue } from 'jotai';
3131
import { columnLayoutAtom } from 'state/columnLayoutAtom';
3232
import BannerCarousel from 'shared/components/FeatureCard/BannerCarousel';
3333
import { ResourceCustomStatusColumns } from './ResourceCustomStatusColumns';
34+
import { isEmpty } from 'lodash';
3435

3536
// This component is loaded after the page mounts.
3637
// Don't try to load it on scroll. It was tested.
@@ -112,7 +113,7 @@ function ResourceDetailsRenderer(props) {
112113
}, [JSON.stringify(resource), props.disableEdit]);
113114

114115
if (loading) return <Spinner />;
115-
if (error) {
116+
if (error && isEmpty(resource)) {
116117
if (error.code === 404) {
117118
return (
118119
<ResourceNotFound

src/shared/hooks/BackendAPI/useGet.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ const useGetHook = (processDataFn) =>
105105
previousRequestNotFinished.current = null;
106106
if (typeof onDataReceived === 'function')
107107
onDataReceived({ error: e });
108-
setTimeout((_) => processError(e));
108+
// Let's wait a moment, because the current request may load
109+
// and showing the error to the user will not be necessary.
110+
setTimeout((_) => processError(e), 100);
109111
}
110112

111113
if (!isSilent && !abortController.current.signal.aborted)

0 commit comments

Comments
 (0)