Fix functions crossreference
This commit is contained in:
@@ -1,6 +1,3 @@
|
||||
module.exports = {
|
||||
extends: [require.resolve('@backstage/cli/config/eslint')],
|
||||
rules: {
|
||||
'no-use-before-define': ['error', { variables: false }],
|
||||
},
|
||||
};
|
||||
|
||||
@@ -33,5 +33,5 @@ export const useAsyncPolling = (
|
||||
const stopPolling = () => {
|
||||
isPolling.current = false;
|
||||
};
|
||||
return { isPolling, startPolling, stopPolling };
|
||||
return { startPolling, stopPolling };
|
||||
};
|
||||
|
||||
@@ -29,11 +29,6 @@ export function useBuildWithSteps(buildId: number) {
|
||||
const api = useApi(circleCIApiRef);
|
||||
const errorApi = useApi(errorApiRef);
|
||||
|
||||
const { isPolling, startPolling, stopPolling } = useAsyncPolling(
|
||||
() => getBuildWithSteps(),
|
||||
INTERVAL_AMOUNT,
|
||||
);
|
||||
|
||||
const getBuildWithSteps = async () => {
|
||||
try {
|
||||
const options = {
|
||||
@@ -45,12 +40,17 @@ export function useBuildWithSteps(buildId: number) {
|
||||
},
|
||||
};
|
||||
const build = await api.getBuild(buildId, options);
|
||||
if (isPolling) dispatch({ type: 'setBuildWithSteps', payload: build });
|
||||
dispatch({ type: 'setBuildWithSteps', payload: build });
|
||||
} catch (e) {
|
||||
errorApi.post(e);
|
||||
}
|
||||
};
|
||||
|
||||
const { startPolling, stopPolling } = useAsyncPolling(
|
||||
getBuildWithSteps,
|
||||
INTERVAL_AMOUNT,
|
||||
);
|
||||
|
||||
const restartBuild = async () => {
|
||||
try {
|
||||
await api.retry(buildId, {
|
||||
|
||||
@@ -27,10 +27,6 @@ export function useBuilds() {
|
||||
|
||||
const api = useApi(circleCIApiRef);
|
||||
const errorApi = useApi(errorApiRef);
|
||||
const { isPolling, startPolling, stopPolling } = useAsyncPolling(
|
||||
() => getBuilds(),
|
||||
INTERVAL_AMOUNT,
|
||||
);
|
||||
|
||||
const getBuilds = async () => {
|
||||
if (settings.owner === '' || settings.repo === '') return;
|
||||
@@ -43,16 +39,20 @@ export function useBuilds() {
|
||||
type: GitType.GITHUB,
|
||||
},
|
||||
});
|
||||
if (isPolling)
|
||||
dispatch({
|
||||
type: 'setBuilds',
|
||||
payload: newBuilds,
|
||||
});
|
||||
dispatch({
|
||||
type: 'setBuilds',
|
||||
payload: newBuilds,
|
||||
});
|
||||
} catch (e) {
|
||||
errorApi.post(e);
|
||||
}
|
||||
};
|
||||
|
||||
const { startPolling, stopPolling } = useAsyncPolling(
|
||||
getBuilds,
|
||||
INTERVAL_AMOUNT,
|
||||
);
|
||||
|
||||
const restartBuild = async (buildId: number) => {
|
||||
try {
|
||||
await api.retry(buildId, {
|
||||
|
||||
Reference in New Issue
Block a user