Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions web/ce/components/maintenance-mode.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"use client";

import { FC, Fragment } from "react";

export const MaintenanceMode: FC = () => <Fragment />;
12 changes: 9 additions & 3 deletions web/core/lib/wrappers/instance-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { LogoSpinner } from "@/components/common";
import { InstanceNotReady } from "@/components/instance";
// hooks
import { useInstance } from "@/hooks/store";
// plane web components
import { MaintenanceMode } from "@/plane-web/components/maintenance-mode";

type TInstanceWrapper = {
children: ReactNode;
Expand All @@ -16,9 +18,11 @@ export const InstanceWrapper: FC<TInstanceWrapper> = observer((props) => {
// store
const { isLoading, instance, error, fetchInstanceInfo } = useInstance();

const { isLoading: isInstanceSWRLoading } = useSWR("INSTANCE_INFORMATION", () => fetchInstanceInfo(), {
revalidateOnFocus: false,
});
const { isLoading: isInstanceSWRLoading, error: instanceSWRError } = useSWR(
"INSTANCE_INFORMATION",
async () => await fetchInstanceInfo(),
{ revalidateOnFocus: false }
);

// loading state
if ((isLoading || isInstanceSWRLoading) && !instance)
Expand All @@ -28,6 +32,8 @@ export const InstanceWrapper: FC<TInstanceWrapper> = observer((props) => {
</div>
);

if (instanceSWRError) return <MaintenanceMode />;

// something went wrong while in the request
if (error && error?.status === "error") return <>{children}</>;

Expand Down
1 change: 1 addition & 0 deletions web/core/store/instance.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export class InstanceStore implements IInstanceStore {
message: "Failed to fetch instance info",
};
});
throw error;
}
};
}
1 change: 1 addition & 0 deletions web/ee/components/maintenance-mode.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "ce/components/maintenance-mode";