Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove ref #8089

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { IconName, IconProp } from '@fortawesome/fontawesome-svg-core';
import React, { type FC, useEffect, useRef, useState } from 'react';
import React, { type FC, useEffect, useState } from 'react';
import { Button, Collection, Menu, MenuItem, MenuTrigger, Popover, Section, Tooltip, TooltipTrigger } from 'react-aria-components';
import { useFetcher, useParams, useRevalidator } from 'react-router-dom';
import { useInterval } from 'react-use';
Expand Down Expand Up @@ -48,8 +48,6 @@ export const GitSyncDropdown: FC<Props> = ({ gitRepository, isInsomniaSyncEnable
const gitFetchFetcher = useFetcher<GitFetchLoaderData>();
const gitStatusFetcher = useFetcher<GitStatusResult>();

const isCheckingGitChanges = useRef(false);

const loadingPush = gitPushFetcher.state === 'loading';
const loadingPull = gitPullFetcher.state === 'loading';
const loadingFetch = gitFetchFetcher.state === 'loading';
Expand Down Expand Up @@ -85,14 +83,14 @@ export const GitSyncDropdown: FC<Props> = ({ gitRepository, isInsomniaSyncEnable
}
}, [gitStatusFetcher, organizationId, projectId, shouldFetchGitRepoStatus, workspaceId]);

useInterval(async () => {
if (isCheckingGitChanges.current) {
return;
}
isCheckingGitChanges.current = true;
await checkGitChanges(workspaceId);
isCheckingGitChanges.current = false;
}, 30 * 1000);
useEffect(() => {
// update committed state on unmount
// this is a sync action which is responsible for cheaply updating a piece of state representing the existence of a diff
// ideally this would not be needed and a diff would be cheaper to find.
return () => {
checkGitChanges(workspaceId);
};
}, [workspaceId]);

useEffect(() => {
if (shouldFetchGitRepoStatus) {
Expand Down
Loading