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";
|
import InstanceLayout from "layouts/instance-layout";
|
||||||
// contexts
|
// contexts
|
||||||
import { ToastContextProvider } from "contexts/toast.context";
|
import { ToastContextProvider } from "contexts/toast.context";
|
||||||
|
import { SWRConfig } from "swr";
|
||||||
|
// constants
|
||||||
|
import { SWR_CONFIG } from "constants/swr-config";
|
||||||
// dynamic imports
|
// dynamic imports
|
||||||
const StoreWrapper = dynamic(() => import("lib/wrappers/store-wrapper"), { ssr: false });
|
const StoreWrapper = dynamic(() => import("lib/wrappers/store-wrapper"), { ssr: false });
|
||||||
const PosthogWrapper = dynamic(() => import("lib/wrappers/posthog-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}
|
posthogAPIKey={envConfig?.posthog_api_key || null}
|
||||||
posthogHost={envConfig?.posthog_host || null}
|
posthogHost={envConfig?.posthog_host || null}
|
||||||
>
|
>
|
||||||
{children}
|
<SWRConfig value={SWR_CONFIG}>{children}</SWRConfig>
|
||||||
</PosthogWrapper>
|
</PosthogWrapper>
|
||||||
</CrispWrapper>
|
</CrispWrapper>
|
||||||
</StoreWrapper>
|
</StoreWrapper>
|
||||||
|
@ -170,7 +170,7 @@ export class CycleIssuesFilterStore extends IssueFilterBaseStore implements ICyc
|
|||||||
|
|
||||||
return filters;
|
return filters;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.fetchFilters(workspaceSlug, projectId, cycleId);
|
console.log("error in fetchCycleFilters", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -215,7 +215,7 @@ export class CycleIssuesFilterStore extends IssueFilterBaseStore implements ICyc
|
|||||||
await this.fetchCycleFilters(workspaceSlug, projectId, cycleId);
|
await this.fetchCycleFilters(workspaceSlug, projectId, cycleId);
|
||||||
return;
|
return;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.fetchFilters(workspaceSlug, projectId, cycleId);
|
console.log("error in cycleFetchFilters", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -170,7 +170,7 @@ export class ModuleIssuesFilterStore extends IssueFilterBaseStore implements IMo
|
|||||||
|
|
||||||
return filters;
|
return filters;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.fetchFilters(workspaceSlug, projectId, moduleId);
|
console.log("error in moduleFetchFilters", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -216,7 +216,7 @@ export class ModuleIssuesFilterStore extends IssueFilterBaseStore implements IMo
|
|||||||
await this.fetchModuleFilters(workspaceSlug, projectId, moduleId);
|
await this.fetchModuleFilters(workspaceSlug, projectId, moduleId);
|
||||||
return;
|
return;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.fetchFilters(workspaceSlug, projectId, moduleId);
|
console.log("error in projectFetchFilters", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -170,7 +170,7 @@ export class ViewIssuesFilterStore extends IssueFilterBaseStore implements IView
|
|||||||
|
|
||||||
return filters;
|
return filters;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.fetchFilters(workspaceSlug, projectId, viewId);
|
console.log("error in viewFetchFilters", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -216,7 +216,7 @@ export class ViewIssuesFilterStore extends IssueFilterBaseStore implements IView
|
|||||||
await this.fetchViewFilters(workspaceSlug, projectId, viewId);
|
await this.fetchViewFilters(workspaceSlug, projectId, viewId);
|
||||||
return;
|
return;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.fetchFilters(workspaceSlug, projectId, viewId);
|
console.log("error in viewFetchFilters", error);
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user