mirror of
https://github.com/makeplane/plane
synced 2025-08-07 19:59:33 +00:00
24 lines
602 B
TypeScript
24 lines
602 B
TypeScript
import { FC, ReactNode } from "react";
|
|
import { observer } from "mobx-react";
|
|
import useSWR from "swr";
|
|
// hooks
|
|
import { useInstance } from "@/hooks/store";
|
|
|
|
type InstanceProviderProps = {
|
|
children: ReactNode;
|
|
};
|
|
|
|
export const InstanceProvider: FC<InstanceProviderProps> = observer((props) => {
|
|
const { children } = props;
|
|
// store hooks
|
|
const { fetchInstanceInfo } = useInstance();
|
|
// fetching instance details
|
|
useSWR("INSTANCE_DETAILS", () => fetchInstanceInfo(), {
|
|
revalidateOnFocus: false,
|
|
revalidateIfStale: false,
|
|
errorRetryCount: 0,
|
|
});
|
|
|
|
return <>{children}</>;
|
|
});
|