chore: infra update for maintenance mode (#5963)
This commit is contained in:
parent
56755b0e9c
commit
9d1253a61d
4 changed files with 16 additions and 3 deletions
5
web/ce/components/maintenance-mode.tsx
Normal file
5
web/ce/components/maintenance-mode.tsx
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
"use client";
|
||||||
|
|
||||||
|
import { FC, Fragment } from "react";
|
||||||
|
|
||||||
|
export const MaintenanceMode: FC = () => <Fragment />;
|
||||||
|
|
@ -6,6 +6,8 @@ import { LogoSpinner } from "@/components/common";
|
||||||
import { InstanceNotReady } from "@/components/instance";
|
import { InstanceNotReady } from "@/components/instance";
|
||||||
// hooks
|
// hooks
|
||||||
import { useInstance } from "@/hooks/store";
|
import { useInstance } from "@/hooks/store";
|
||||||
|
// plane web components
|
||||||
|
import { MaintenanceMode } from "@/plane-web/components/maintenance-mode";
|
||||||
|
|
||||||
type TInstanceWrapper = {
|
type TInstanceWrapper = {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
|
|
@ -16,9 +18,11 @@ export const InstanceWrapper: FC<TInstanceWrapper> = observer((props) => {
|
||||||
// store
|
// store
|
||||||
const { isLoading, instance, error, fetchInstanceInfo } = useInstance();
|
const { isLoading, instance, error, fetchInstanceInfo } = useInstance();
|
||||||
|
|
||||||
const { isLoading: isInstanceSWRLoading } = useSWR("INSTANCE_INFORMATION", () => fetchInstanceInfo(), {
|
const { isLoading: isInstanceSWRLoading, error: instanceSWRError } = useSWR(
|
||||||
revalidateOnFocus: false,
|
"INSTANCE_INFORMATION",
|
||||||
});
|
async () => await fetchInstanceInfo(),
|
||||||
|
{ revalidateOnFocus: false }
|
||||||
|
);
|
||||||
|
|
||||||
// loading state
|
// loading state
|
||||||
if ((isLoading || isInstanceSWRLoading) && !instance)
|
if ((isLoading || isInstanceSWRLoading) && !instance)
|
||||||
|
|
@ -28,6 +32,8 @@ export const InstanceWrapper: FC<TInstanceWrapper> = observer((props) => {
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (instanceSWRError) return <MaintenanceMode />;
|
||||||
|
|
||||||
// something went wrong while in the request
|
// something went wrong while in the request
|
||||||
if (error && error?.status === "error") return <>{children}</>;
|
if (error && error?.status === "error") return <>{children}</>;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,7 @@ export class InstanceStore implements IInstanceStore {
|
||||||
message: "Failed to fetch instance info",
|
message: "Failed to fetch instance info",
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
1
web/ee/components/maintenance-mode.tsx
Normal file
1
web/ee/components/maintenance-mode.tsx
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
export * from "ce/components/maintenance-mode";
|
||||||
Loading…
Add table
Add a link
Reference in a new issue