Skip to content

Commit

Permalink
chore: remove cyclic deps
Browse files Browse the repository at this point in the history
  • Loading branch information
brayn003 committed Feb 13, 2025
1 parent f4e4dd9 commit 35854cb
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GitArtifactType } from "git/constants/enums";
import type { GitArtifactDef } from "git/store/types";
import type { GitArtifactDef } from "git/types";

export default function applicationArtifact(
baseApplicationId: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
import { getCurrentApplication } from "ee/selectors/applicationSelectors";
import type { ConnectResponse } from "git/requests/connectRequest.types";
import { gitArtifactActions } from "git/store/gitArtifactSlice";
import type { GitArtifactDef } from "git/store/types";
import type { GitApplicationArtifact } from "git/types";
import type { GitApplicationArtifact, GitArtifactDef } from "git/types";
import { put, select } from "redux-saga/effects";
import { getCurrentPageId } from "selectors/editorSelectors";
import history from "utils/history";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { GitArtifactDef } from "git/store/types";
import type { GitArtifactDef } from "git/types";

export default function* packageConnectToGitSaga(
// need this to preserve interface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GitArtifactType } from "git/constants/enums";
import type { GitArtifactDef } from "git/store/types";
import type { GitArtifactDef } from "git/types";

export default function packageArtifact(basePackageId: string): GitArtifactDef {
return {
Expand Down
5 changes: 2 additions & 3 deletions app/client/src/git/components/GitContextProvider/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import React, { createContext, useContext, useMemo } from "react";
import type { GitArtifactType } from "git/constants/enums";
import type { FetchStatusResponseData } from "git/requests/fetchStatusRequest.types";
import type { GitArtifactDef } from "git/store/types";
import type { StatusTreeStruct } from "../StatusChanges/types";
import type { GitArtifact, GitArtifactDef } from "git/types";
import type { StatusTreeStruct } from "git/components/StatusChanges/types";
import type { Workspace } from "ee/constants/workspaceConstants";
import { noop } from "lodash";
import type { GitArtifact } from "git/types";

export interface GitContextValue {
artifactDef: GitArtifactDef | null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import {
REVOKE_EXISTING_REPOSITORIES,
} from "ee/constants/messages";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
import type { GitArtifactDef } from "git/store/types";
import { noop } from "lodash";
import { applicationArtifact } from "git/artifact-helpers/application";
import type {
GitApplicationArtifact,
GitArtifact,
GitArtifactDef,
GitPackageArtifact,
} from "git/types";

Expand Down
2 changes: 1 addition & 1 deletion app/client/src/git/helpers/isAutocommitEnabled.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GitArtifactType } from "git/constants/enums";
import type { GitArtifactDef } from "git/store/types";
import type { GitArtifactDef } from "git/types";

// ? Temporary, will be removed when the feature is supported in packages
function isAutocommitEnabled(artifactDef: GitArtifactDef) {
Expand Down
2 changes: 1 addition & 1 deletion app/client/src/git/helpers/isProtectedBranchesEnabled.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GitArtifactType } from "git/constants/enums";
import type { GitArtifactDef } from "git/store/types";
import type { GitArtifactDef } from "git/types";

// ? Temporary, will be removed when the feature is supported in packages
function isProtectedBranchesEnabled(artifactDef: GitArtifactDef) {
Expand Down
3 changes: 2 additions & 1 deletion app/client/src/git/hooks/useArtifactSelector.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { useGitContext } from "git/components/GitContextProvider";
import type { GitArtifactDef, GitRootState } from "git/store/types";
import type { GitRootState } from "git/store/types";
import type { GitArtifactDef } from "git/types";
import { useSelector } from "react-redux";
import type { Tail } from "redux-saga/effects";

Expand Down
2 changes: 1 addition & 1 deletion app/client/src/git/hooks/useDisconnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { useCallback } from "react";
import { useDispatch } from "react-redux";
import useArtifactSelector from "./useArtifactSelector";
import type { GitArtifactDef } from "git/store/types";
import type { GitArtifactDef } from "git/types";

export default function useDisconnect() {
const { artifactDef } = useGitContext();
Expand Down
1 change: 0 additions & 1 deletion app/client/src/git/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export {

// types
export type {
GitArtifactDef,
GitArtifactRootReduxState,
GitGlobalReduxState,
} from "./store/types";
Expand Down
3 changes: 2 additions & 1 deletion app/client/src/git/sagas/disconnectSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import type { DisconnectResponse } from "git/requests/disconnectRequest.types";
import { gitArtifactActions } from "git/store/gitArtifactSlice";
import { selectDisconnectArtifactDef } from "git/store/selectors/gitArtifactSelectors";
import { selectGitApiContractsEnabled } from "git/store/selectors/gitFeatureFlagSelectors";
import type { GitArtifactDef, GitArtifactPayloadAction } from "git/store/types";
import type { GitArtifactPayloadAction } from "git/store/types";
import { call, put, select } from "redux-saga/effects";
import { validateResponse } from "sagas/ErrorSagas";
import history from "utils/history";
import handleApiErrors from "./helpers/handleApiErrors";
import type { GitArtifactDef } from "git/types";

export default function* disconnectSaga(action: GitArtifactPayloadAction) {
const { artifactDef } = action.payload;
Expand Down
3 changes: 2 additions & 1 deletion app/client/src/git/sagas/triggerAutocommitSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type {
import type { TriggerAutocommitInitPayload } from "git/store/actions/triggerAutocommitActions";
import { gitArtifactActions } from "git/store/gitArtifactSlice";
import { selectAutocommitEnabled } from "git/store/selectors/gitArtifactSelectors";
import type { GitArtifactDef, GitArtifactPayloadAction } from "git/store/types";
import type { GitArtifactPayloadAction } from "git/store/types";
import {
call,
cancel,
Expand All @@ -27,6 +27,7 @@ import type { Task } from "redux-saga";
import { validateResponse } from "sagas/ErrorSagas";
import { selectGitApiContractsEnabled } from "git/store/selectors/gitFeatureFlagSelectors";
import handleApiErrors from "./helpers/handleApiErrors";
import type { GitArtifactDef } from "git/types";

const AUTOCOMMIT_POLL_DELAY = 1000;
const AUTOCOMMIT_WHITELISTED_STATES = [
Expand Down
3 changes: 2 additions & 1 deletion app/client/src/git/store/actions/uiActions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { GitOpsTab, GitSettingsTab } from "git/constants/enums";
import { createArtifactAction } from "../helpers/createArtifactAction";
import type { GitArtifactDef, GitGlobalReduxState } from "../types";
import type { GitGlobalReduxState } from "../types";
import type { PayloadAction } from "@reduxjs/toolkit";
import type { GitArtifactDef } from "git/types";

// connect modal
export interface ToggleConnectModalPayload {
Expand Down
3 changes: 2 additions & 1 deletion app/client/src/git/store/selectors/gitArtifactSelectors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { GitArtifactDef, GitRootState } from "../types";
import type { GitArtifactDef } from "git/types";
import type { GitRootState } from "git/store/types";

export const selectGitArtifact = (
state: GitRootState,
Expand Down
5 changes: 1 addition & 4 deletions app/client/src/git/store/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type {
} from "git/ee/store/types";
import type { FetchGlobalSSHKeyResponseData } from "git/requests/fetchGlobalSSHKeyRequest.types";
import type { FetchRefsResponseData } from "git/requests/fetchRefsRequest.types";
import type { GitArtifactDef } from "git/types";

export interface GitApiError extends ApiResponseError {
errorType?: string;
Expand Down Expand Up @@ -82,10 +83,6 @@ export interface GitArtifactUIReduxState
conflictErrorModalOpen: boolean;
}

export interface GitArtifactDef {
artifactType: GitArtifactType;
baseArtifactId: string;
}
export interface GitArtifactReduxState {
ui: GitArtifactUIReduxState;
apiResponses: GitArtifactAPIResponsesReduxState;
Expand Down
6 changes: 6 additions & 0 deletions app/client/src/git/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Package } from "ee/constants/PackageConstants";
import type { ApplicationPayload } from "entities/Application";
import type { GitArtifactType } from "./constants/enums";

export interface GitRef {
refName: string;
Expand All @@ -12,6 +13,11 @@ export interface GitBranch {
default: boolean;
}

export interface GitArtifactDef {
artifactType: GitArtifactType;
baseArtifactId: string;
}

export type GitApplicationArtifact = ApplicationPayload;

export type GitPackageArtifact = Package;
Expand Down

0 comments on commit 35854cb

Please sign in to comment.