forked from github/plane
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:
parent
7684a2c091
commit
5b67f27345
5
web/constants/swr-config.ts
Normal file
5
web/constants/swr-config.ts
Normal file
@ -0,0 +1,5 @@
|
||||
export const SWR_CONFIG = {
|
||||
refreshWhenHidden: false,
|
||||
revalidateIfStale: false,
|
||||
errorRetryCount: 3,
|
||||
};
|
@ -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>
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user