fix: remove get requests from the catch block (#3135)

* fix: refetching project filters on error

* fix: get request in the catch block
This commit is contained in:
Aaryan Khandelwal 2023-12-14 19:55:45 +05:30 committed by GitHub
parent 7684a2c091
commit 5b67f27345
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 7 deletions

View File

@ -0,0 +1,5 @@
export const SWR_CONFIG = {
refreshWhenHidden: false,
revalidateIfStale: false,
errorRetryCount: 3,
};

View File

@ -12,6 +12,9 @@ import { THEMES } from "constants/themes";
import InstanceLayout from "layouts/instance-layout";
// contexts
import { ToastContextProvider } from "contexts/toast.context";
import { SWRConfig } from "swr";
// constants
import { SWR_CONFIG } from "constants/swr-config";
// dynamic imports
const StoreWrapper = dynamic(() => import("lib/wrappers/store-wrapper"), { ssr: false });
const PosthogWrapper = dynamic(() => import("lib/wrappers/posthog-wrapper"), { ssr: false });
@ -48,7 +51,7 @@ export const AppProvider: FC<IAppProvider> = observer((props) => {
posthogAPIKey={envConfig?.posthog_api_key || null}
posthogHost={envConfig?.posthog_host || null}
>
{children}
<SWRConfig value={SWR_CONFIG}>{children}</SWRConfig>
</PosthogWrapper>
</CrispWrapper>
</StoreWrapper>

View File

@ -170,7 +170,7 @@ export class CycleIssuesFilterStore extends IssueFilterBaseStore implements ICyc
return filters;
} catch (error) {
this.fetchFilters(workspaceSlug, projectId, cycleId);
console.log("error in fetchCycleFilters", error);
throw error;
}
};
@ -215,7 +215,7 @@ export class CycleIssuesFilterStore extends IssueFilterBaseStore implements ICyc
await this.fetchCycleFilters(workspaceSlug, projectId, cycleId);
return;
} catch (error) {
this.fetchFilters(workspaceSlug, projectId, cycleId);
console.log("error in cycleFetchFilters", error);
throw error;
}
};

View File

@ -170,7 +170,7 @@ export class ModuleIssuesFilterStore extends IssueFilterBaseStore implements IMo
return filters;
} catch (error) {
this.fetchFilters(workspaceSlug, projectId, moduleId);
console.log("error in moduleFetchFilters", error);
throw error;
}
};
@ -216,7 +216,7 @@ export class ModuleIssuesFilterStore extends IssueFilterBaseStore implements IMo
await this.fetchModuleFilters(workspaceSlug, projectId, moduleId);
return;
} catch (error) {
this.fetchFilters(workspaceSlug, projectId, moduleId);
console.log("error in projectFetchFilters", error);
throw error;
}
};

View File

@ -170,7 +170,7 @@ export class ViewIssuesFilterStore extends IssueFilterBaseStore implements IView
return filters;
} catch (error) {
this.fetchFilters(workspaceSlug, projectId, viewId);
console.log("error in viewFetchFilters", error);
throw error;
}
};
@ -216,7 +216,7 @@ export class ViewIssuesFilterStore extends IssueFilterBaseStore implements IView
await this.fetchViewFilters(workspaceSlug, projectId, viewId);
return;
} catch (error) {
this.fetchFilters(workspaceSlug, projectId, viewId);
console.log("error in viewFetchFilters", error);
throw error;
}
};