diff --git a/src/Panel.tsx b/src/Panel.tsx
index 9ec41ac5..75c96c4b 100644
--- a/src/Panel.tsx
+++ b/src/Panel.tsx
@@ -83,12 +83,6 @@ export const Panel = ({ active, api }: PanelProps) => {
return withProviders();
}
- if (gitInfoError) {
- // eslint-disable-next-line no-console
- console.error(gitInfoError);
- return withProviders();
- }
-
// Render the Authentication flow if the user is not signed in.
if (!accessToken) {
return withProviders(
@@ -102,7 +96,7 @@ export const Panel = ({ active, api }: PanelProps) => {
}
// Momentarily wait on addonState (should be very fast)
- if (projectInfoLoading || !gitInfo) {
+ if (projectInfoLoading) {
return active ? : null;
}
@@ -115,6 +109,12 @@ export const Panel = ({ active, api }: PanelProps) => {
/>
);
+ if (gitInfoError || !gitInfo) {
+ // eslint-disable-next-line no-console
+ console.error(gitInfoError);
+ return withProviders();
+ }
+
if (projectUpdatingFailed) {
// These should always be set when we get this error
if (!configFile) throw new Error(`Missing config file after configuration failure`);
diff --git a/src/index.ts b/src/index.ts
index 7f74cf70..97e10cda 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -32,7 +32,8 @@ function managerEntries(entry: string[] = []) {
const observeGitInfo = async (
interval: number,
callback: (info: GitInfo, prevInfo?: GitInfo) => void,
- errorCallback: (e: Error) => void
+ errorCallback: (e: Error) => void,
+ projectId?: string
) => {
let prev: GitInfo | undefined;
let prevError: Error | undefined;
@@ -47,12 +48,12 @@ const observeGitInfo = async (
prevError = undefined;
timer = setTimeout(act, interval);
} catch (e: any) {
- if (prevError?.message !== e.message) {
+ errorCallback(e);
+ if (projectId && prevError?.message !== e.message) {
console.error(`Failed to fetch git info, with error:\n${e}`);
- errorCallback(e);
+ prev = undefined;
+ prevError = e;
}
- prev = undefined;
- prevError = e;
timer = setTimeout(act, interval);
}
};
diff --git a/src/screens/GitNotFound/GitNotFound.tsx b/src/screens/GitNotFound/GitNotFound.tsx
index 856c7b73..34ef9373 100644
--- a/src/screens/GitNotFound/GitNotFound.tsx
+++ b/src/screens/GitNotFound/GitNotFound.tsx
@@ -12,10 +12,6 @@ import { Stack } from "../../components/Stack";
import { Text } from "../../components/Text";
import { useUninstallAddon } from "../Uninstalled/UninstallContext";
-interface GitNotFoundProps {
- gitInfoError: Error;
-}
-
const InfoSection = styled(Section)(({ theme }) => ({
display: "flex",
flexDirection: "row",
@@ -42,7 +38,7 @@ const StyledCode = styled(Code)(({ theme }) => ({
fontSize: "12px",
}));
-export const GitNotFound = ({ gitInfoError }: GitNotFoundProps) => {
+export const GitNotFound = () => {
const { uninstallAddon } = useUninstallAddon();
return (