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

chore: git mod - integration app #38315

Merged
merged 137 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from 131 commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
1119f65
chore: adding apis for git
brayn003 Dec 5, 2024
2900b65
fix: review changes
brayn003 Dec 5, 2024
0d1fa18
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 5, 2024
146238c
fix: fixing enum imports
brayn003 Dec 5, 2024
e72e02f
chore: changing named export to default export
brayn003 Dec 6, 2024
54b5d93
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 6, 2024
a1b608b
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 6, 2024
0bb662f
fix: adding saga for commit and connect
brayn003 Dec 7, 2024
d7e6c79
chore: adding global profile and config redux slice
brayn003 Dec 7, 2024
02e128b
chore: adding saga for git profile update
brayn003 Dec 7, 2024
3218b3a
chore: adding fetch branches saga
brayn003 Dec 7, 2024
f9c4030
chore: adding fetch and update local profile
brayn003 Dec 7, 2024
adafd14
fix: fixing connectsaga
brayn003 Dec 7, 2024
488b346
fix: review changes
brayn003 Dec 8, 2024
942193d
chore: adding branch based sagas
brayn003 Dec 9, 2024
e9167f2
fix: moving things around
brayn003 Dec 9, 2024
d024160
chore: adding ctx
brayn003 Dec 9, 2024
ef34582
chore: expanding context provider and making contextaware comps
brayn003 Dec 9, 2024
c3d9a31
fix: remove gittest
brayn003 Dec 9, 2024
fa8c461
chore: adding init sagas
brayn003 Dec 10, 2024
9b1414e
fix: test fixes
brayn003 Dec 10, 2024
2de337e
fix: review changes
brayn003 Dec 10, 2024
40f057e
Merge branch 'chore/git-mod-5' of github.com:appsmithorg/appsmith int…
brayn003 Dec 10, 2024
826dbf8
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 10, 2024
3a47055
chore: adding autocommit to saga
brayn003 Dec 10, 2024
ca19474
fix: adding relevant selectors for quick git actions
brayn003 Dec 10, 2024
3a2a045
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 11, 2024
59f91f4
fix: resolving conflict errors
brayn003 Dec 11, 2024
e1eb35a
fix: review changes
brayn003 Dec 11, 2024
3c4a4c2
Merge branch 'chore/git-mod-5' of github.com:appsmithorg/appsmith int…
brayn003 Dec 11, 2024
fbcf6ae
fix: fixing test cases
brayn003 Dec 11, 2024
56cbaef
fix: fixing more test cases
brayn003 Dec 11, 2024
f8545b4
fix: changing AxiosResponse to AxiosPromise
brayn003 Dec 11, 2024
65e9ea6
fix: fixing build and naming issues
brayn003 Dec 11, 2024
2b7c3d2
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 11, 2024
f613ae1
fix: remove expect error
brayn003 Dec 11, 2024
adddd08
chore: adding git ops modal
brayn003 Dec 11, 2024
c6343d3
fix: arranging dumb components in a better fashion
brayn003 Dec 11, 2024
c5c9585
fix: adding conflicterror and conflicterrormodal
brayn003 Dec 11, 2024
c5b8cf3
fix: adding pull sagas
brayn003 Dec 11, 2024
bcef9f5
chore: adding deploy tab
brayn003 Dec 11, 2024
0e84fb8
chore: adding merge tab
brayn003 Dec 11, 2024
c88bc0b
fix: review changes
brayn003 Dec 12, 2024
885446c
Merge branch 'chore/git-mod-6' of github.com:appsmithorg/appsmith int…
brayn003 Dec 12, 2024
e106d43
fix: better handling of ctx values
brayn003 Dec 12, 2024
005a655
fix: minor fixes to merge comp
brayn003 Dec 12, 2024
ba6ac37
chore: adding skeleton for status
brayn003 Dec 12, 2024
54ac997
chore: adding status component and transformer
brayn003 Dec 12, 2024
8c310af
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 12, 2024
523296b
fix: adding autocommit statusbar
brayn003 Dec 12, 2024
8745497
Merge branch 'chore/git-mod-7' of github.com:appsmithorg/appsmith int…
brayn003 Dec 12, 2024
9d57e5a
chore: adding git settings modal
brayn003 Dec 12, 2024
44167c0
chore: wip - git settings modal
brayn003 Dec 13, 2024
f698d26
fix: fixing error handling
brayn003 Dec 13, 2024
245cb9b
chore: minor changes in error handling
brayn003 Dec 13, 2024
cc35140
chore: review fixes
brayn003 Dec 13, 2024
1b1da07
Merge branch 'chore/git-mod-7' of github.com:appsmithorg/appsmith int…
brayn003 Dec 13, 2024
8dc482f
fix: review comments
brayn003 Dec 13, 2024
e70f659
Merge branch 'chore/git-mod-7' of github.com:appsmithorg/appsmith int…
brayn003 Dec 13, 2024
801b06b
chore: minor fixes for build failures
brayn003 Dec 13, 2024
b4f8925
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 13, 2024
ec461fd
chore: review fixes
brayn003 Dec 13, 2024
7f54647
Merge branch 'chore/git-mod-7' of github.com:appsmithorg/appsmith int…
brayn003 Dec 13, 2024
b997ada
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 13, 2024
a569b22
chore: shifting fixes from ee to ee
brayn003 Dec 13, 2024
f715c2a
fix: minor fixes
brayn003 Dec 13, 2024
1273fc6
chore: adding initial state
brayn003 Dec 13, 2024
0be3210
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 13, 2024
2953823
chore: renaming files
brayn003 Dec 13, 2024
2be8c89
fix: minor
brayn003 Dec 13, 2024
e1588c9
chore: fixes build issue
brayn003 Dec 13, 2024
008f857
chore: adding branch protection
brayn003 Dec 13, 2024
fe620bd
chore: adding local profile
brayn003 Dec 13, 2024
d8dca7f
fix: issue with localprofile
brayn003 Dec 13, 2024
e23819b
chore: adding general tab
brayn003 Dec 14, 2024
a7f5832
chore: added disconnect modal
brayn003 Dec 14, 2024
7b48aa2
chore: adding disable autocommit modal
brayn003 Dec 14, 2024
57aa219
chore: adding disconnect and toggle autocommit saga
brayn003 Dec 14, 2024
612c35a
chore: adding base for CD
brayn003 Dec 14, 2024
ee50685
chore: moving things around
brayn003 Dec 14, 2024
e20e0a2
chore: adding minor fixes
brayn003 Dec 14, 2024
b16bf38
chore: adding connect first draft
brayn003 Dec 15, 2024
34f7a00
chore: adding logic for connect modal
brayn003 Dec 15, 2024
a71a664
chore: adding fixes
brayn003 Dec 15, 2024
5e40b10
chore: review comment fix
brayn003 Dec 15, 2024
3921112
chore: adding branch popup
brayn003 Dec 15, 2024
9071d0e
chore: wip ce-ee split
brayn003 Dec 16, 2024
6314fe2
chore: additional ee files
brayn003 Dec 16, 2024
8d077c8
chore: wip more ce-ee split
brayn003 Dec 16, 2024
56f05cf
chore: removing old ee folder
brayn003 Dec 16, 2024
24d5e1c
Merge branch 'chore/git-mod-8' of github.com:appsmithorg/appsmith int…
brayn003 Dec 16, 2024
546fd66
chore: conflict errors
brayn003 Dec 16, 2024
bbbee85
chore: fix branch list
brayn003 Dec 16, 2024
52b5c4f
chore: adding ff
brayn003 Dec 16, 2024
f789c5a
chore: unlicensed cd
brayn003 Dec 16, 2024
062e19a
Merge branch 'chore/git-mod-8' of github.com:appsmithorg/appsmith int…
brayn003 Dec 16, 2024
a6529bc
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 16, 2024
bc6b90e
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 17, 2024
243f299
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 17, 2024
5d758ca
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 17, 2024
34d96b4
chore: fixing typo
brayn003 Dec 17, 2024
4831434
chore: adding integration behind feature flag
brayn003 Dec 17, 2024
df628d7
chore: mod flag for components and selectors
brayn003 Dec 17, 2024
c100cc2
chore: introducing artfactdef for better state mgmt
brayn003 Dec 17, 2024
64c8a84
chore: moving selectors
brayn003 Dec 18, 2024
41e8b6f
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 23, 2024
b407de1
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 23, 2024
e724bcb
chore: typo error
brayn003 Dec 23, 2024
469a675
chore: fix action dispatch call
brayn003 Dec 23, 2024
7478804
chore: renaming files and types more consistently
brayn003 Dec 23, 2024
bc06f26
chore: fixing connect and import flow
brayn003 Dec 23, 2024
2730e4a
chore: integrating git profile
brayn003 Dec 23, 2024
022ac38
chore: rm console
brayn003 Dec 23, 2024
a38be13
chore: adding import modal on cta
brayn003 Dec 23, 2024
35ff365
feat: integrating with deploy btn
brayn003 Dec 23, 2024
1d6177f
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 23, 2024
1498ddc
chore: fix git import modal
brayn003 Dec 23, 2024
bda63a5
chore: putting gitapplicationProvider in better places
brayn003 Dec 23, 2024
a0a3d29
chore: fix connect issue
brayn003 Dec 23, 2024
1f55194
chore: minor fixes
brayn003 Dec 23, 2024
a9a65c3
chore: minor fixes for disconnect flow
brayn003 Dec 23, 2024
ad48cd9
chore: passing unit tests
brayn003 Dec 24, 2024
e7c116c
chore: fixing connect flow
brayn003 Dec 24, 2024
a6926c9
chore: fixing unit tests
brayn003 Dec 24, 2024
a2e48c9
chore: build failure
brayn003 Dec 24, 2024
741d1f0
chore: fixing unit test with mock
brayn003 Dec 24, 2024
10a4325
chore: fixing status comp
brayn003 Dec 24, 2024
5c46d32
fix: fixing when ff is off
brayn003 Dec 24, 2024
4b18bae
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 24, 2024
0b57fae
chore: fix typo
brayn003 Dec 24, 2024
059417b
chore: fixing unit tests
brayn003 Dec 24, 2024
9eaa84c
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 25, 2024
e678dd9
chore: cytest fix
brayn003 Dec 25, 2024
5fd6853
chore: fixing cypress tests
brayn003 Dec 25, 2024
358b659
chore: fixing selectors for repetition
brayn003 Dec 27, 2024
83579a9
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 27, 2024
19f3ca0
Merge branch 'release' of github.com:appsmithorg/appsmith into chore/…
brayn003 Dec 28, 2024
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
Expand Up @@ -1103,6 +1103,10 @@ const ContentTypeRaw = importSvg(
async () => import("../__assets__/icons/ads/content-type-raw.svg"),
);

const CloudIconV2 = importSvg(
async () => import("../__assets__/icons/ads/cloudy-line.svg"),
);

import PlayIconPNG from "../__assets__/icons/control/play-icon.png";

function PlayIconPNGWrapper() {
Expand Down Expand Up @@ -1177,6 +1181,7 @@ const ICON_LOOKUP = {
"close-modal": CloseLineIcon,
"close-x": CloseLineIcon,
"cloud-off-line": CloudOfflineIcon,
"cloud-v2": CloudIconV2,
"collapse-control": CollapseIcon,
"column-freeze": ColumnFreeze,
"column-unfreeze": SubtractIcon,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const blockAirgappedRoutes = (config: InternalAxiosRequestConfig) => {

const addGitBranchHeader = (config: InternalAxiosRequestConfig) => {
const state = store.getState();
// ! git mod - not sure how to replace this, we could directly read state if required
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In your git folder where you have API requests; why not create an HOC for the Api class that injects branch as header. IIRC the config property that .get .post accept has an option to pass additional headers

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would ideally want to remove this from the interceptor logic and pass it with the api explicitly. But not tampering this right now

const branch = getCurrentGitBranch(state) || getQueryParamsObject().branch;

return _addGitBranchHeader(config, { branch });
Expand Down
2 changes: 2 additions & 0 deletions app/client/src/ce/entities/FeatureFlag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const FEATURE_FLAG = {
"release_table_html_column_type_enabled",
release_gs_all_sheets_options_enabled:
"release_gs_all_sheets_options_enabled",
release_git_modularisation_enabled: "release_git_modularisation_enabled",
ab_premium_datasources_view_enabled: "ab_premium_datasources_view_enabled",
kill_session_recordings_enabled: "kill_session_recordings_enabled",
config_mask_session_recordings_enabled:
Expand Down Expand Up @@ -95,6 +96,7 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = {
release_evaluation_scope_cache: false,
release_table_html_column_type_enabled: false,
release_gs_all_sheets_options_enabled: false,
release_git_modularisation_enabled: false,
ab_premium_datasources_view_enabled: false,
kill_session_recordings_enabled: false,
config_user_session_recordings_enabled: true,
Expand Down
26 changes: 21 additions & 5 deletions app/client/src/ce/navigation/FocusStrategy/AppIDEFocusStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { all, select, take } from "redux-saga/effects";
import type { FocusPath, FocusStrategy } from "sagas/FocusRetentionSaga";
import type { AppsmithLocationState } from "utils/history";
import { NavigationMethod } from "utils/history";
import { getCurrentGitBranch } from "selectors/gitSyncSelectors";
import type { FocusEntityInfo } from "navigation/FocusEntity";
import {
FocusEntity,
Expand All @@ -18,6 +17,9 @@ import {
widgetListURL,
} from "ee/RouteBuilder";
import AppIDEFocusElements from "../FocusElements/AppIDE";
import { getCurrentBaseApplicationId } from "selectors/editorSelectors";
import { selectGitCurrentBranch } from "selectors/gitModSelectors";
import { applicationArtifact } from "git/artifact-helpers/application";

function shouldSetState(
prevPath: string,
Expand Down Expand Up @@ -86,8 +88,14 @@ const isPageChange = (prevPath: string, currentPath: string) => {
);
};

export const createEditorFocusInfoKey = (basePageId: string, branch?: string) =>
`EDITOR_STATE.${basePageId}#${branch}`;
export const createEditorFocusInfoKey = (
basePageId: string,
branch: string | null = null,
) =>
branch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we changing these?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Branch can either be undefined or null. With the old implementation - when branch is not present it would return either EDITOR_STATE.pageid.undefined or EDITOR_STATE.pageid.null. This creates issues. So, I have modified the logic to ignore branch totally when it is either undefined or null

? `EDITOR_STATE.${basePageId}#${branch}`
: `EDITOR_STATE.${basePageId}`;

export const createEditorFocusInfo = (basePageId: string, branch?: string) => ({
key: createEditorFocusInfoKey(basePageId, branch),
entityInfo: {
Expand All @@ -109,7 +117,11 @@ export const AppIDEFocusStrategy: FocusStrategy = {
return [];
}

const branch: string | undefined = yield select(getCurrentGitBranch);
const baseApplicationId: string = yield select(getCurrentBaseApplicationId);
const branch: string | undefined = yield select(
selectGitCurrentBranch,
applicationArtifact(baseApplicationId),
);
const entities: Array<{ entityInfo: FocusEntityInfo; key: string }> = [];
const prevEntityInfo = identifyEntityFromPath(previousPath);
const currentEntityInfo = identifyEntityFromPath(currentPath);
Expand All @@ -136,7 +148,11 @@ export const AppIDEFocusStrategy: FocusStrategy = {
return entities;
},
*getEntitiesForStore(path: string, currentPath: string) {
const branch: string | undefined = yield select(getCurrentGitBranch);
const baseApplicationId: string = yield select(getCurrentBaseApplicationId);
const branch: string | undefined = yield select(
selectGitCurrentBranch,
applicationArtifact(baseApplicationId),
);
const entities: Array<FocusPath> = [];
const currentFocusEntityInfo = identifyEntityFromPath(currentPath);
const prevFocusEntityInfo = identifyEntityFromPath(path);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import CreateNewAppsOption from "./CreateNewAppsOption";
import { BrowserRouter as Router } from "react-router-dom";
import { unitTestBaseMockStore } from "layoutSystems/common/dropTarget/unitTestUtils";

jest.mock("selectors/gitModSelectors", () => ({
selectCombinedPreviewMode: jest.fn(() => false),
}));

const defaultStoreState = {
...unitTestBaseMockStore,
tenant: {
Expand Down
12 changes: 10 additions & 2 deletions app/client/src/ce/pages/Applications/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ import { MOBILE_MAX_WIDTH } from "constants/AppConstants";
import { Indices } from "constants/Layers";
import ImportModal from "pages/common/ImportModal";
import SharedUserList from "pages/common/SharedUserList";
import GitSyncModal from "pages/Editor/gitSync/GitSyncModal";
import ReconnectDatasourceModal from "pages/Editor/gitSync/ReconnectDatasourceModal";
import RepoLimitExceededErrorModal from "pages/Editor/gitSync/RepoLimitExceededErrorModal";
import AnalyticsUtil from "ee/utils/AnalyticsUtil";
Expand All @@ -133,6 +132,15 @@ import { getAssetUrl } from "ee/utils/airgapHelpers";
import { ASSETS_CDN_URL } from "constants/ThirdPartyConstants";
import { LayoutSystemTypes } from "layoutSystems/types";
import { getIsAnvilLayoutEnabled } from "layoutSystems/anvil/integrations/selectors";
import OldGitSyncModal from "pages/Editor/gitSync/GitSyncModal";
import { useGitModEnabled } from "pages/Editor/gitSync/hooks/modHooks";
import { GitImportModal as NewGitImportModal } from "git";

function GitImportModal() {
const isGitModEnabled = useGitModEnabled();

return isGitModEnabled ? <NewGitImportModal /> : <OldGitSyncModal isImport />;
}

export const { cloudHosting } = getAppsmithConfigs();

Expand Down Expand Up @@ -955,7 +963,7 @@ export function ApplicationsSection(props: any) {
isMobile={isMobile}
>
{workspacesListComponent}
<GitSyncModal isImport />
<GitImportModal />
<ReconnectDatasourceModal />
</ApplicationContainer>
);
Expand Down
4 changes: 2 additions & 2 deletions app/client/src/ce/pages/Editor/IDE/MainPane/useRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ import DataSourceEditor from "pages/Editor/DataSourceEditor";
import DatasourceBlankState from "pages/Editor/DataSourceEditor/DatasourceBlankState";
import type { RouteProps } from "react-router";
import { useSelector } from "react-redux";
import { combinedPreviewModeSelector } from "selectors/editorSelectors";
import { lazy, Suspense } from "react";
import React from "react";

import { retryPromise } from "utils/AppsmithUtils";
import Skeleton from "widgets/Skeleton";
import { selectCombinedPreviewMode } from "selectors/gitModSelectors";

const FirstTimeUserOnboardingChecklist = lazy(async () =>
retryPromise(
Expand Down Expand Up @@ -67,7 +67,7 @@ export interface RouteReturnType extends RouteProps {
*/

function useRoutes(path: string): RouteReturnType[] {
const isPreviewMode = useSelector(combinedPreviewModeSelector);
const isPreviewMode = useSelector(selectCombinedPreviewMode);

return [
{
Expand Down
9 changes: 9 additions & 0 deletions app/client/src/ce/reducers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ import type { ActiveField } from "reducers/uiReducers/activeFieldEditorReducer";
import type { SelectedWorkspaceReduxState } from "ee/reducers/uiReducers/selectedWorkspaceReducer";
import type { ConsolidatedPageLoadState } from "reducers/uiReducers/consolidatedPageLoadReducer";
import type { BuildingBlocksReduxState } from "reducers/uiReducers/buildingBlockReducer";
import type { GitArtifactRootReduxState, GitGlobalReduxState } from "git";
import { gitReducer } from "git/store";

export const reducerObject = {
entities: entityReducer,
Expand All @@ -86,6 +88,9 @@ export const reducerObject = {
settings: SettingsReducer,
tenant: tenantReducer,
linting: lintErrorReducer,
// not sure what is the best way to integrate git reducer behind a feature flag
brayn003 marked this conversation as resolved.
Show resolved Hide resolved
// although integrating it directly should be fine as it will not be used unless the feature is enabled
git: gitReducer,
};

export interface AppState {
Expand Down Expand Up @@ -176,4 +181,8 @@ export interface AppState {
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
tenant: TenantReduxState<any>;
git: {
global: GitGlobalReduxState;
artifacts: GitArtifactRootReduxState;
};
}
16 changes: 16 additions & 0 deletions app/client/src/ce/reducers/uiReducers/applicationsReducer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import {
import produce from "immer";
import { isEmpty } from "lodash";
import type { ApplicationPayload } from "entities/Application";
import { gitConnectSuccess, type GitConnectSuccessPayload } from "git";
import type { PayloadAction } from "@reduxjs/toolkit";

export const initialState: ApplicationsReduxState = {
isSavingAppName: false,
Expand Down Expand Up @@ -744,6 +746,20 @@ export const handlers = {
isSavingNavigationSetting: false,
};
},
// git
[gitConnectSuccess.type]: (
state: ApplicationsReduxState,
action: PayloadAction<GitConnectSuccessPayload>,
) => {
return {
...state,
currentApplication: {
...state.currentApplication,
gitApplicationMetadata:
action.payload.responseData.gitApplicationMetadata,
},
};
},
Comment on lines +750 to +762
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to do this in the applicationsReducer?

Copy link
Contributor Author

@brayn003 brayn003 Dec 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we do the same thing with old implementation as well. Didn't want to change it too much. Will revisit later

};

const applicationsReducer = createReducer(initialState, handlers);
Expand Down
18 changes: 13 additions & 5 deletions app/client/src/ce/sagas/PageSagas.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ import {
import { IncorrectBindingError, validateResponse } from "sagas/ErrorSagas";
import type { ApiResponse } from "api/ApiResponses";
import {
combinedPreviewModeSelector,
getCurrentApplicationId,
getCurrentBaseApplicationId,
getCurrentLayoutId,
getCurrentPageId,
getCurrentPageName,
Expand Down Expand Up @@ -128,7 +128,6 @@ import { getPageList } from "ee/selectors/entitiesSelector";
import { setPreviewModeAction } from "actions/editorActions";
import { SelectionRequestType } from "sagas/WidgetSelectUtils";
import { toast } from "@appsmith/ads";
import { getCurrentGitBranch } from "selectors/gitSyncSelectors";
import type { MainCanvasReduxState } from "reducers/uiReducers/mainCanvasReducer";
import { UserCancelledActionExecutionError } from "sagas/ActionExecution/errorUtils";
import { getInstanceId } from "ee/selectors/tenantSelectors";
Expand All @@ -150,6 +149,11 @@ import { getIsAnvilLayout } from "layoutSystems/anvil/integrations/selectors";
import { convertToBasePageIdSelector } from "selectors/pageListSelectors";
import type { Page } from "entities/Page";
import { ConsolidatedPageLoadApi } from "api";
import {
selectCombinedPreviewMode,
selectGitCurrentBranch,
} from "selectors/gitModSelectors";
import { applicationArtifact } from "git/artifact-helpers/application";

export const checkIfMigrationIsNeeded = (
fetchPageResponse?: FetchPageResponse,
Expand All @@ -172,7 +176,11 @@ export function* refreshTheApp() {
const currentPageId: string = yield select(getCurrentPageId);
const defaultBasePageId: string = yield select(getDefaultBasePageId);
const pagesList: Page[] = yield select(getPageList);
const gitBranch: string = yield select(getCurrentGitBranch);
const baseApplicationId: string = yield select(getCurrentBaseApplicationId);
const gitBranch: string | undefined = yield select(
selectGitCurrentBranch,
applicationArtifact(baseApplicationId),
);

const isCurrentPageIdInList =
pagesList.filter((page) => page.pageId === currentPageId).length > 0;
Expand Down Expand Up @@ -637,7 +645,7 @@ export function* saveLayoutSaga(action: ReduxAction<{ isRetry?: boolean }>) {
try {
const currentPageId: string = yield select(getCurrentPageId);
const currentPage: Page = yield select(getPageById(currentPageId));
const isPreviewMode: boolean = yield select(combinedPreviewModeSelector);
const isPreviewMode: boolean = yield select(selectCombinedPreviewMode);

const appMode: APP_MODE | undefined = yield select(getAppMode);

Expand Down Expand Up @@ -1401,7 +1409,7 @@ export function* setCanvasCardsStateSaga(action: ReduxAction<string>) {
}

export function* setPreviewModeInitSaga(action: ReduxAction<boolean>) {
const isPreviewMode: boolean = yield select(combinedPreviewModeSelector);
const isPreviewMode: boolean = yield select(selectCombinedPreviewMode);

if (action.payload) {
// we animate out elements and then move to the canvas
Expand Down
4 changes: 4 additions & 0 deletions app/client/src/ce/sagas/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import sendSideBySideWidgetHoverAnalyticsEventSaga from "sagas/AnalyticsSaga";

/* Sagas that are registered by a module that is designed to be independent of the core platform */
import ternSagas from "sagas/TernSaga";
import gitSagas from "git/sagas";

export const sagas = [
initSagas,
Expand Down Expand Up @@ -106,4 +107,7 @@ export const sagas = [
ternSagas,
ideSagas,
sendSideBySideWidgetHoverAnalyticsEventSaga,
// not sure what is the best way to integrate git sagas behind a feature flag
// although integrating it directly should be fine as it will not be used unless the feature is enabled
brayn003 marked this conversation as resolved.
Show resolved Hide resolved
gitSagas,
];
Loading
Loading