From 8bb61d996a6017887dff90fb83b6baf1cf88521d Mon Sep 17 00:00:00 2001 From: Vemparala Surya Vamsi <121419957+vsvamsi1@users.noreply.github.com> Date: Tue, 16 Jan 2024 10:16:48 +0530 Subject: [PATCH] chore: reverted consolidated api (#30314) ## Description Reverted consolidated api changes and also some CE related changes to make it compatible with EE. #### PR fixes following issue(s) Reverts #29650 & #29939 #### Type of change - Chore (housekeeping or task changes that don't impact user perception) > > > ## Testing #### How Has This Been Tested? - [ ] Manual - [ ] JUnit - [ ] Jest - [x ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed ## Summary by CodeRabbit - **Refactor** - Enhanced the reliability and efficiency of Cypress e2e tests by adjusting wait conditions and assertions. - Simplified network request handling across various test cases. - Updated test logic to align with changes in application data structure and network requests. - **Tests** - Improved test stability for application import/export, Git sync, page load behavior, and widget interactions. - Refined mobile responsiveness tests to accurately validate layout conversions and autofill behaviors. - **Chores** - Removed deprecated feature flags and code related to consolidated page load functionality. - Cleaned up unused parameters and simplified action payloads in Redux actions. - **Documentation** - Updated comments for clarity in test specifications. - **Style** - Adjusted code styling for consistency across test suites. - **Bug Fixes** - Fixed data retrieval logic in tests to ensure correct data extraction from API responses. --- .../Apps/ImportExportForkApplication_spec.js | 4 +- .../e2e/Regression/Apps/PromisesApp_spec.js | 2 +- .../Binding/JSObject_Postgress_Table_spec.js | 2 +- .../ExplorerTests/Page_Load_Spec.js | 2 +- .../ForkApplicationWithinAppEditor_spec.ts | 4 +- .../ClientSide/Fork/ForkApplication_spec.ts | 4 +- .../Git/GitSync/GitSyncedApps_spec.js | 16 +- .../Git/GitSync/MergeViaRemote_spec.ts | 5 +- .../Git/GitSync/SwitchBranches_spec.js | 2 +- .../AutoFillWidgets_Reflow_spec.ts | 2 +- ...gorithm_AutoLayout_Validation_BasicSpec.js | 4 +- ...ithm_FixedLayout_Mobile_Validation_Spec.js | 4 +- ...lgorithm_FixedLayout_Validation_Desktop.js | 4 +- .../FirstTimeUserOnboarding_spec.js | 2 +- .../OtherUIFeatures/Analytics_spec.js | 4 +- .../OtherUIFeatures/ApplicationURL_spec.js | 17 +- .../OtherUIFeatures/Omnibar_spec.js | 4 +- .../OtherUIFeatures/ViewMode_spec.js | 6 +- .../Widgets/CodeScanner/CodeScanner2_spec.ts | 12 +- .../Widgets/Others/IconButton_2_spec.ts | 2 +- .../Widgets/TableV2/table_data_change_spec.ts | 4 +- .../Workspace/ShareAppTests_Spec.ts | 22 +- .../WorkspaceImportApplication_spec.js | 5 +- .../LoginTests/LoginFailure_spec.js | 2 +- .../ServerSide/OnLoadTests/JSOnLoad1_Spec.ts | 2 +- .../JSOnLoad_cyclic_dependency_errors_spec.js | 4 +- .../ServerSide/OnLoadTests/JsOnLoad3_Spec.ts | 2 +- .../OnLoadTests/OnLoadActions_Spec.ts | 30 +- .../cypress/support/Objects/FeatureFlags.ts | 60 ++-- .../cypress/support/Pages/AggregateHelper.ts | 4 +- .../cypress/support/Pages/DataSources.ts | 2 +- .../cypress/support/Pages/DeployModeHelper.ts | 4 +- app/client/cypress/support/Pages/HomePage.ts | 10 +- app/client/cypress/support/Pages/Table.ts | 2 +- .../cypress/support/WorkspaceCommands.js | 5 +- app/client/cypress/support/commands.js | 14 +- app/client/cypress/support/e2e.js | 3 +- app/client/src/actions/JSLibraryActions.ts | 8 +- app/client/src/actions/appThemingActions.tsx | 15 +- app/client/src/actions/authActions.ts | 4 +- app/client/src/actions/datasourceActions.ts | 10 +- app/client/src/actions/initActions.ts | 4 - app/client/src/actions/jsActionActions.ts | 10 +- app/client/src/actions/pageActions.tsx | 8 +- app/client/src/actions/pluginActionActions.ts | 19 +- app/client/src/actions/pluginActions.ts | 10 +- app/client/src/actions/userActions.ts | 16 +- .../src/api/ConsolidatedPageLoadApi.tsx | 24 -- app/client/src/api/PageApi.tsx | 1 - app/client/src/ce/AppRouter.tsx | 77 ++++-- app/client/src/ce/actions/tenantActions.ts | 7 +- app/client/src/ce/api/ApplicationApi.tsx | 1 - .../src/ce/constants/ReduxActionConstants.tsx | 2 - .../src/ce/entities/Engine/actionHelpers.ts | 10 +- app/client/src/ce/entities/FeatureFlag.ts | 3 - app/client/src/ce/reducers/index.tsx | 2 - .../src/ce/reducers/uiReducers/index.tsx | 2 - app/client/src/ce/sagas/ApplicationSagas.tsx | 11 +- app/client/src/ce/sagas/JSActionSagas.ts | 25 +- app/client/src/ce/sagas/PageSagas.tsx | 62 ++--- app/client/src/ce/sagas/tenantSagas.tsx | 11 +- app/client/src/ce/sagas/userSagas.tsx | 32 +-- .../src/entities/Engine/AppEditorEngine.ts | 62 ++--- .../src/entities/Engine/AppViewerEngine.ts | 35 +-- app/client/src/entities/Engine/index.ts | 20 +- .../uiReducers/consolidatedPageLoadReducer.ts | 21 -- app/client/src/sagas/ActionSagas.ts | 22 +- app/client/src/sagas/AppThemingSaga.tsx | 24 +- app/client/src/sagas/DatasourcesSagas.ts | 26 +- app/client/src/sagas/InitSagas.ts | 259 +++--------------- app/client/src/sagas/JSLibrarySaga.ts | 18 +- app/client/src/sagas/PluginSagas.ts | 34 +-- .../src/sagas/__tests__/initSagas.test.ts | 18 +- app/client/src/sagas/helper.ts | 27 -- app/client/src/selectors/ui.tsx | 3 - 75 files changed, 350 insertions(+), 870 deletions(-) delete mode 100644 app/client/src/api/ConsolidatedPageLoadApi.tsx delete mode 100644 app/client/src/reducers/uiReducers/consolidatedPageLoadReducer.ts diff --git a/app/client/cypress/e2e/Regression/Apps/ImportExportForkApplication_spec.js b/app/client/cypress/e2e/Regression/Apps/ImportExportForkApplication_spec.js index 2f2210b663..13a5a2784b 100644 --- a/app/client/cypress/e2e/Regression/Apps/ImportExportForkApplication_spec.js +++ b/app/client/cypress/e2e/Regression/Apps/ImportExportForkApplication_spec.js @@ -136,8 +136,8 @@ describe( } const importedApp = interception.response.body.data.application; const appSlug = importedApp.slug; - cy.wait("@getConsolidatedData").then((interception) => { - const pages = interception.response.body.data.pages.data.pages; + cy.wait("@getPagesForCreateApp").then((interception) => { + const pages = interception.response.body.data.pages; let defaultPage = pages.find( (eachPage) => !!eachPage.isDefault, ); diff --git a/app/client/cypress/e2e/Regression/Apps/PromisesApp_spec.js b/app/client/cypress/e2e/Regression/Apps/PromisesApp_spec.js index faa619eee1..feb8a14292 100644 --- a/app/client/cypress/e2e/Regression/Apps/PromisesApp_spec.js +++ b/app/client/cypress/e2e/Regression/Apps/PromisesApp_spec.js @@ -60,7 +60,7 @@ describe( }, ); EditorNavigation.SelectEntityByName("Page1", EntityType.Page); - cy.wait("@getConsolidatedData"); + cy.wait("@getPage"); // verify text in the text widget agHelper.AssertContains( diff --git a/app/client/cypress/e2e/Regression/ClientSide/Binding/JSObject_Postgress_Table_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Binding/JSObject_Postgress_Table_spec.js index 5322bdf440..851e7139c9 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Binding/JSObject_Postgress_Table_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Binding/JSObject_Postgress_Table_spec.js @@ -55,7 +55,7 @@ describe( _.deployMode.NavigateBacktoEditor(); cy.wait(2000); cy.visit(currentUrl, { timeout: 60000 }); - cy.wait("@getConsolidatedData").should( + cy.wait("@getPagesForViewApp").should( "have.nested.property", "response.body.responseMeta.status", 200, diff --git a/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Page_Load_Spec.js b/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Page_Load_Spec.js index 2dfc825e2e..99ee6fe669 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Page_Load_Spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/ExplorerTests/Page_Load_Spec.js @@ -47,7 +47,7 @@ describe("Page Load tests", { tags: ["@tag.IDE"] }, () => { "This is Page 2", ); // Test after reload - agHelper.RefreshPage("getConsolidatedData"); + agHelper.RefreshPage("viewPage"); // Assert active page tab cy.get(".t--page-switch-tab") .contains("Page2") diff --git a/app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplicationWithinAppEditor_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplicationWithinAppEditor_spec.ts index 8bd63a0639..d3ec1e2e13 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplicationWithinAppEditor_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplicationWithinAppEditor_spec.ts @@ -43,10 +43,10 @@ describe( .its("response.body.responseMeta.status") .should("eq", 200); // check that forked application has same dsl - cy.get("@getConsolidatedData") + cy.get("@getPage") .its("response.body.data") .then((data) => { - forkedApplicationDsl = data.pageWithMigratedDsl.data.layouts[0].dsl; + forkedApplicationDsl = data.layouts[0].dsl; expect(JSON.stringify(forkedApplicationDsl)).to.contain( JSON.stringify(parentApplicationDsl), ); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplication_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplication_spec.ts index c911835a84..d03a90c653 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplication_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Fork/ForkApplication_spec.ts @@ -55,8 +55,8 @@ describe( .should("eq", 200); cy.wait("@getWorkspace"); // check that forked application has same dsl - cy.get("@getConsolidatedData").then((httpResponse) => { - const data = httpResponse.response.body.data?.pageWithMigratedDsl?.data; + cy.get("@getPage").then((httpResponse) => { + const data = httpResponse.response.body.data; forkedApplicationDsl = data.layouts[0].dsl; cy.log(JSON.stringify(forkedApplicationDsl)); cy.log(JSON.stringify(parentApplicationDsl)); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitSyncedApps_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitSyncedApps_spec.js index aaa78f4c9a..d3c5125f41 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitSyncedApps_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/GitSyncedApps_spec.js @@ -125,7 +125,7 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () { cy.fixture("datasources").then((datasourceFormData) => { cy.Createpage(newPage); cy.get(`.t--entity-item:contains(${newPage})`).click(); - cy.wait("@getConsolidatedData"); + cy.wait("@getPage"); // create a get api call apiPage.CreateAndFillApi(datasourceFormData["echoApiUrl"], "get_data"); @@ -176,7 +176,7 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () { 201, ); cy.get(`.t--entity-item:contains(${newPage} Copy)`).click(); - cy.wait("@getConsolidatedData"); + cy.wait("@getPage"); }); }); @@ -194,7 +194,7 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () { .invoke("val") .should("be.oneOf", ["morpheus", "This is a test"]); cy.get(`.t--entity-item:contains(${newPage})`).first().click(); - cy.wait("@getConsolidatedData"); + cy.wait("@getPage"); cy.get(".t--draggable-inputwidgetv2") .first() .find(".bp3-input") @@ -205,13 +205,13 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () { .should("have.value", "This is a test"); cy.get(`.t--entity-item:contains(${pageName})`).first().click(); - cy.wait("@getConsolidatedData"); + cy.wait("@getPage"); cy.readTabledataPublish("0", "1").then((cellData) => { expect(cellData).to.be.equal("New Config"); }); cy.get(`.t--entity-item:contains(${pageName} Copy)`).click(); - cy.wait("@getConsolidatedData"); + cy.wait("@getPage"); cy.readTabledataPublish("0", "1").then((cellData) => { expect(cellData).to.be.equal("New Config"); }); @@ -232,7 +232,7 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () { expect(cellData).to.be.equal("New Config"); }); cy.get(".t--page-switch-tab").contains(`${newPage}`).click({ force: true }); - agHelper.RefreshPage("getConsolidatedData"); + agHelper.RefreshPage("viewPage"); cy.get(".bp3-input") .first() .invoke("val") @@ -433,7 +433,7 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () { }); EditorNavigation.SelectEntityByName("Child_Page", EntityType.Page); - cy.wait("@getConsolidatedData"); + cy.wait("@getPage"); cy.get(homePageLocators.publishButton).click(); cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit"); cy.get(gitSyncLocators.commitButton).click(); @@ -458,7 +458,7 @@ describe("Git sync apps", { tags: ["@tag.Git"] }, function () { gitSync.CreateGitBranch(tempBranch1, true); // delete page from page settings EditorNavigation.SelectEntityByName("Child_Page Copy", EntityType.Page); - cy.wait("@getConsolidatedData"); + cy.wait("@getPage"); cy.Deletepage("Child_Page Copy"); cy.get(homePageLocators.publishButton).click(); cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/MergeViaRemote_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/MergeViaRemote_spec.ts index fd2a2a268e..59e7e471a9 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/MergeViaRemote_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/MergeViaRemote_spec.ts @@ -231,13 +231,12 @@ describe( cy.wait(1000); let legacyPathname = ""; let newPathname = ""; - // question to qa can we remove this assertion cy.intercept("GET", "/api/v1/pages?*mode=EDIT", (req) => { req.continue(); }).as("appAndPages"); cy.reload(); - cy.wait("@getConsolidatedData").then((intercept2) => { - const { application, pages } = intercept2.response.body.data.pages.data; + cy.wait("@appAndPages").then((intercept2) => { + const { application, pages } = intercept2.response.body.data; const defaultPage = pages.find((p) => p.isDefault); legacyPathname = `/applications/${application.id}/pages/${defaultPage.id}`; newPathname = `/app/${application.slug}/${defaultPage.slug}-${defaultPage.id}`; diff --git a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/SwitchBranches_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/SwitchBranches_spec.js index 862a874276..a6b54090c2 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/SwitchBranches_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Git/GitSync/SwitchBranches_spec.js @@ -164,7 +164,7 @@ describe("Git sync:", { tags: ["@tag.Git"] }, function () { urlObject.searchParams.set(branchQueryKey, parentBranchKey); cy.visit(urlObject.toString(), { timeout: 60000 }); - cy.wait("@getConsolidatedData").should( + cy.wait("@getPagesForViewApp").should( "have.nested.property", "response.body.responseMeta.status", 200, diff --git a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoFillWidgets_Reflow_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoFillWidgets_Reflow_spec.ts index 69a10e37ae..eb468797e4 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoFillWidgets_Reflow_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/AutoFillWidgets_Reflow_spec.ts @@ -40,7 +40,7 @@ describe( currentUrl = url; cy.log(currentUrl); homePage.Signout(false); - agHelper.VisitNAssert(url, "getConsolidatedData"); + agHelper.VisitNAssert(url, "getPagesForViewApp"); agHelper.AssertCSS( autoLayout.getAutoLayoutLayerClassName("0", 0), "flex-wrap", diff --git a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_AutoLayout_Validation_BasicSpec.js b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_AutoLayout_Validation_BasicSpec.js index 0b5d3ecd22..88f94859ca 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_AutoLayout_Validation_BasicSpec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_AutoLayout_Validation_BasicSpec.js @@ -14,8 +14,8 @@ describe( it("1. Validate basic conversion algorithm usecases", function () { _.agHelper.AddDsl("conversionFrAutoLayoutDsl"); //cy.openPropertyPane("containerwidget"); - cy.get("@getConsolidatedData").then((httpResponse) => { - const data = httpResponse.response.body.data.pageWithMigratedDsl.data; + cy.get("@getPage").then((httpResponse) => { + const data = httpResponse.response.body.data; testHeight = data.layouts[0].dsl.bottomRow; }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_FixedLayout_Mobile_Validation_Spec.js b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_FixedLayout_Mobile_Validation_Spec.js index ec58ddf630..17c52b1c10 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_FixedLayout_Mobile_Validation_Spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_FixedLayout_Mobile_Validation_Spec.js @@ -8,8 +8,8 @@ describe( it("1. Validate basic conversion algorithm usecases fixed layout usecase Mobile", function () { agHelper.AddDsl("conversionFrAutoLayoutDsl"); //cy.openPropertyPane("containerwidget"); - cy.get("@getConsolidatedData").then((httpResponse) => { - const data = httpResponse.response.body.data.pageWithMigratedDsl.data; + cy.get("@getPage").then((httpResponse) => { + const data = httpResponse.response.body.data; testHeight = data.layouts[0].dsl.bottomRow; //expect(testHeight).to.equal(380); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_FixedLayout_Validation_Desktop.js b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_FixedLayout_Validation_Desktop.js index 2642ba69ca..20b8a710b2 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_FixedLayout_Validation_Desktop.js +++ b/app/client/cypress/e2e/Regression/ClientSide/MobileResponsiveTests/ConversionAlgorithm_FixedLayout_Validation_Desktop.js @@ -8,8 +8,8 @@ describe( it("1. Validate basic conversion algorithm usecases fixed layout Desktop", function () { _.agHelper.AddDsl("conversionFrAutoLayoutDsl"); //cy.openPropertyPane("containerwidget"); - cy.get("@getConsolidatedData").then((httpResponse) => { - const data = httpResponse.response.body.data.pageWithMigratedDsl.data; + cy.get("@getPage").then((httpResponse) => { + const data = httpResponse.response.body.data; testHeight = data.layouts[0].dsl.bottomRow; //expect(testHeight).to.equal(380); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Onboarding/FirstTimeUserOnboarding_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Onboarding/FirstTimeUserOnboarding_spec.js index 96ac304472..f5fd3b30d2 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Onboarding/FirstTimeUserOnboarding_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Onboarding/FirstTimeUserOnboarding_spec.js @@ -196,7 +196,7 @@ describe("FirstTimeUserOnboarding", function () { agHelper.AssertElementVisibility(OnboardingLocator.widgetSidebar); agHelper.AssertElementVisibility(OnboardingLocator.dropTarget); entityExplorer.DragDropWidgetNVerify(draggableWidgets.TEXT); - agHelper.RefreshPage("getConsolidatedData"); + agHelper.RefreshPage("getPage"); agHelper.AssertElementEnabledDisabled( debuggerHelper.locators._helpButton, 0, diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Analytics_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Analytics_spec.js index ddc3041e19..66c10385f0 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Analytics_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Analytics_spec.js @@ -49,7 +49,7 @@ describe( it("2. Should check smartlook is not initialised when enableTelemtry is false", function () { agHelper.VisitNAssert("/applications", "getReleaseItems"); cy.wait(3000); - cy.wait("@getConsolidatedData"); + cy.wait("@getMe"); cy.window().then((window) => { expect(window.smartlook).to.be.equal(undefined); }); @@ -69,7 +69,7 @@ describe( it("3. Should check Sentry is not initialised when enableTelemtry is false", function () { agHelper.VisitNAssert("/applications", "getReleaseItems"); cy.wait(3000); - cy.wait("@getConsolidatedData"); + cy.wait("@getMe"); cy.window().then((window) => { expect(window.Sentry).to.be.equal(undefined); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ApplicationURL_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ApplicationURL_spec.js index 0375c226aa..18cb476088 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ApplicationURL_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ApplicationURL_spec.js @@ -66,8 +66,8 @@ describe("Slug URLs", () => { cy.SearchApp(applicationName); - cy.wait("@getConsolidatedData").then((intercept) => { - const { application, pages } = intercept.response.body.data.pages.data; + cy.wait("@getPagesForCreateApp").then((intercept) => { + const { application, pages } = intercept.response.body.data; const defaultPage = pages.find((p) => p.isDefault); cy.location().should((loc) => { @@ -99,10 +99,8 @@ describe("Slug URLs", () => { cy.get(".t--upgrade-confirm").click({ force: true }); - cy.wait("@getConsolidatedData").then((intercept) => { - const { application, pages } = - intercept.response.body.data.pages.data; - + cy.wait("@getPagesForCreateApp").then((intercept) => { + const { application, pages } = intercept.response.body.data; const currentPage = pages.find((p) => p.id === currentPageId); cy.location().should((loc) => { @@ -134,12 +132,7 @@ describe("Slug URLs", () => { it("4. Checks redirect url", () => { cy.url().then((url) => { homePage.Signout(true); - agHelper.VisitNAssert(url + "?embed=true&a=b"); - - // status should be 401 since the user is still unauthenticated from the previous signin request - cy.wait("@getConsolidatedData").then((res1) => { - expect(res1.response).to.have.property("statusCode", 401); - }); + agHelper.VisitNAssert(url + "?embed=true&a=b", "signUpLogin"); agHelper.AssertURL( `?redirectUrl=${encodeURIComponent(url + "?embed=true&a=b")}`, ); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Omnibar_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Omnibar_spec.js index a7e9503410..c46e49ee0a 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Omnibar_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/Omnibar_spec.js @@ -25,7 +25,7 @@ describe("Omnibar functionality test cases", () => { deployMode.StubWindowNAssert( '//span[text()="Learn more"]', "connect-to-a-database", - "getConsolidatedData", + "getPluginForm", ); }); @@ -119,7 +119,7 @@ describe("Omnibar functionality test cases", () => { deployMode.StubWindowNAssert( omnibar.discordLink, "https://discord.com/invite/rBTTVJp", - "getConsolidatedData", + "getPluginForm", ); }, ); diff --git a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ViewMode_spec.js b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ViewMode_spec.js index b7da0c5c6a..2000131a77 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ViewMode_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/OtherUIFeatures/ViewMode_spec.js @@ -23,7 +23,7 @@ describe("Preview mode functionality", function () { beforeEach(() => { cy.getSharedUrl().then((url) => { - agHelper.VisitNAssert(url, "getConsolidatedData"), + agHelper.VisitNAssert(url, "getPagesForViewApp"), agHelper.AssertElementVisibility( locators._widgetInDeployed(draggableWidgets.BUTTON), ); @@ -42,7 +42,7 @@ describe("Preview mode functionality", function () { cy.url().then((url) => { url = new URL(url); url.searchParams.append("embed", "true"); - agHelper.VisitNAssert(url.toString(), "getConsolidatedData"); + agHelper.VisitNAssert(url.toString(), "getPagesForViewApp"); agHelper.AssertElementVisibility( locators._widgetInDeployed(draggableWidgets.BUTTON), ); @@ -55,7 +55,7 @@ describe("Preview mode functionality", function () { url = new URL(url); url.searchParams.append("embed", "true"); url.searchParams.append("navbar", "true"); - agHelper.VisitNAssert(url.toString(), "getConsolidatedData"); + agHelper.VisitNAssert(url.toString(), "getPagesForViewApp"); agHelper.AssertElementVisibility( locators._widgetInDeployed(draggableWidgets.BUTTON), ); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/CodeScanner/CodeScanner2_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/CodeScanner/CodeScanner2_spec.ts index 32604807f2..32c44c46e3 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/CodeScanner/CodeScanner2_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/CodeScanner/CodeScanner2_spec.ts @@ -93,7 +93,7 @@ describe( //Open the Code Scanner modal and Scan a QR using fake webcam video cy.task("changeVideoSource", "qrCodeVideo.y4m"); - agHelper.RefreshPage("getConsolidatedData"); + agHelper.RefreshPage("viewPage"); agHelper.ValidateToastMessage("Code scanned successfully!"); //Verify that the scanned data is correctly displayed on the app's screen @@ -190,7 +190,7 @@ describe( //Open the Code Scanner modal and Scan a QR using fake webcam video cy.task("changeVideoSource", "qrCodeVideo.y4m"); - agHelper.RefreshPage("getConsolidatedData"); + agHelper.RefreshPage("viewPage"); agHelper.AssertElementVisibility( widgetLocators.codeScannerNewScanButton, ); @@ -211,7 +211,7 @@ describe( it("5. Validate scanning rotated QR code.", () => { //Open the Code Scanner modal and Scan rotated QR code using fake webcam video cy.task("changeVideoSource", "rotatedQRCode.y4m"); - agHelper.RefreshPage("getConsolidatedData"); + agHelper.RefreshPage("viewPage"); agHelper.AssertElementVisibility(widgetLocators.codeScannerNewScanButton); agHelper.GetNClick(widgetLocators.codeScannerNewScanButton, 0, true); agHelper.AssertElementVisibility(widgetLocators.codeScannerModal); @@ -229,7 +229,7 @@ describe( it("6. Validate scanning invalid QR code.", () => { //Open the Code Scanner modal and Scan invalid QR code using fake webcam video cy.task("changeVideoSource", "invalidQRCode.y4m"); - agHelper.RefreshPage("getConsolidatedData"); + agHelper.RefreshPage("viewPage"); agHelper.AssertElementVisibility(widgetLocators.codeScannerNewScanButton); agHelper.GetNClick(widgetLocators.codeScannerNewScanButton, 0, true); agHelper.AssertElementVisibility(widgetLocators.codeScannerModal); @@ -247,7 +247,7 @@ describe( it("7. Validate scanning multiple QR codes.", () => { //Open the Code Scanner modal and Scan multiple QR codes using fake webcam video cy.task("changeVideoSource", "multipleQRCodes.y4m"); - agHelper.RefreshPage("getConsolidatedData"); + agHelper.RefreshPage("viewPage"); agHelper.AssertElementVisibility(widgetLocators.codeScannerNewScanButton); agHelper.GetNClick(widgetLocators.codeScannerNewScanButton, 0, true); agHelper.AssertElementVisibility(widgetLocators.codeScannerModal); @@ -284,7 +284,7 @@ describe( it("9. Validate scanning high density QR code.", () => { //Open the Code Scanner modal and Scan high density QR code using fake webcam video cy.task("changeVideoSource", "highDensityQRCode.y4m"); - agHelper.RefreshPage("getConsolidatedData"); + agHelper.RefreshPage("viewPage"); agHelper.AssertElementVisibility(widgetLocators.codeScannerNewScanButton); agHelper.GetNClick(widgetLocators.codeScannerNewScanButton, 0, true); agHelper.AssertElementVisibility(widgetLocators.codeScannerModal); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/IconButton_2_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/IconButton_2_spec.ts index 6d62fdcb9e..9ad35f4c38 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/IconButton_2_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Others/IconButton_2_spec.ts @@ -123,7 +123,7 @@ describe( agHelper.WaitUntilEleAppear( locators._widgetInDeployed("iconbuttonwidget"), ); - assertHelper.AssertNetworkResponseData("@getConsolidatedData"); + assertHelper.AssertNetworkResponseData("@viewPage"); assertHelper.AssertDocumentReady(); agHelper.Sleep(3000); //for view page to complete loading & then navigate back deployMode.NavigateBacktoEditor(); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/table_data_change_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/table_data_change_spec.ts index 4433da97b7..20c0114d8e 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/table_data_change_spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/TableV2/table_data_change_spec.ts @@ -192,7 +192,7 @@ describe( freezeColumnFromDropdown("status", "left"); freezeColumnFromDropdown("action", "right"); - agHelper.RefreshPage("getConsolidatedData"); + agHelper.RefreshPage("viewPage"); checkIfColumnIsFrozenViaCSS("status"); checkIfColumnIsFrozenViaCSS("action"); @@ -215,7 +215,7 @@ describe( freezeColumnFromDropdown("id", "left"); freezeColumnFromDropdown("updatedAt", "right"); - agHelper.RefreshPage("getConsolidatedData"); + agHelper.RefreshPage("viewPage"); checkIfColumnIsFrozenViaCSS("id"); checkIfColumnIsFrozenViaCSS("updatedAt"); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts index 72d500f281..49ad8a8747 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts +++ b/app/client/cypress/e2e/Regression/ClientSide/Workspace/ShareAppTests_Spec.ts @@ -77,7 +77,7 @@ describe( agHelper.Sleep(2000); homePage.EditAppFromAppHover(); agHelper.AssertElementAbsence(locators._loading); - assertHelper.AssertNetworkStatus("@getConsolidatedData"); + assertHelper.AssertNetworkStatus("@getPagesForCreateApp"); agHelper.GetNClick(inviteModal.locators._shareButton, 0, true); agHelper.GetNClick(homePage._sharePublicToggle, 0, true); agHelper.Sleep(5000); @@ -94,7 +94,7 @@ describe( }); it("4. Open the app without login and validate public access of Application", function () { - agHelper.VisitNAssert(currentUrl, "@getConsolidatedData"); + agHelper.VisitNAssert(currentUrl, "@getPagesForViewApp"); agHelper.Sleep(3000); agHelper.GetText(locators._emptyPageTxt).then((text) => { expect(text).to.equal("This page seems to be blank"); @@ -114,7 +114,7 @@ describe( Cypress.env("TESTUSERNAME2"), Cypress.env("TESTPASSWORD2"), ); - agHelper.VisitNAssert(currentUrl, "@getConsolidatedData"); + agHelper.VisitNAssert(currentUrl, "@getPagesForViewApp"); agHelper.GetText(locators._emptyPageTxt).then((text) => { expect(text).to.equal("This page seems to be blank"); }); @@ -152,23 +152,11 @@ describe( ); agHelper.Sleep(); //for CI agHelper.VisitNAssert(currentUrl); - cy.get("@getConsolidatedData").then((interception: any) => { - expect( - Number(interception.response.body.data.pages.responseMeta.status), - ).to.eq(404); - }); + assertHelper.AssertNetworkStatus("@getPagesForViewApp", 404); homePage.LogOutviaAPI(); // visit the app as anonymous user and validate redirection to login page agHelper.VisitNAssert(currentUrl); - cy.get("@getConsolidatedData").then((interception: any) => { - //we make two getConsolidatedData calls during the first we get a 404 error which redirects the browser back to signin - //page and that causes to fetch the getConsolidatedData without any page params again we should expect no pages resp during then - if (interception.response.body.data.pages) { - expect( - Number(interception.response.body.data.pages.responseMeta.status), - ).to.eq(404); - } - }); + assertHelper.AssertNetworkStatus("@getPagesForViewApp", 404); agHelper.AssertContains("Sign in to your account", "be.visible"); }); diff --git a/app/client/cypress/e2e/Regression/ClientSide/Workspace/WorkspaceImportApplication_spec.js b/app/client/cypress/e2e/Regression/ClientSide/Workspace/WorkspaceImportApplication_spec.js index 8aa56a3af4..3f92fb1e21 100644 --- a/app/client/cypress/e2e/Regression/ClientSide/Workspace/WorkspaceImportApplication_spec.js +++ b/app/client/cypress/e2e/Regression/ClientSide/Workspace/WorkspaceImportApplication_spec.js @@ -67,9 +67,8 @@ describe( "contain", "Application imported successfully", ); - cy.wait("@getConsolidatedData").then((interception) => { - const pages = - interception.response.body.data.pages.data.pages; + cy.wait("@getPagesForCreateApp").then((interception) => { + const pages = interception.response.body.data.pages; const pageSlug = pages.find((page) => page.isDefault)?.slug ?? "page"; cy.url().should( diff --git a/app/client/cypress/e2e/Regression/ServerSide/LoginTests/LoginFailure_spec.js b/app/client/cypress/e2e/Regression/ServerSide/LoginTests/LoginFailure_spec.js index 57caa0aff9..5130f66e1d 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/LoginTests/LoginFailure_spec.js +++ b/app/client/cypress/e2e/Regression/ServerSide/LoginTests/LoginFailure_spec.js @@ -15,7 +15,7 @@ describe("Login failure", function () { .then((url) => { urlWithoutQueryParams = url.split("?")[0]; homePage.LogOutviaAPI(); - agHelper.VisitNAssert(urlWithoutQueryParams, "getConsolidatedData"); + agHelper.VisitNAssert(urlWithoutQueryParams, "signUpLogin"); // agHelper.Sleep(3000); //for page redirect to complete // assertHelper.AssertNetworkStatus("signUpLogin"); }) diff --git a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad1_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad1_Spec.ts index 592c02accf..131098b08c 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad1_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad1_Spec.ts @@ -106,7 +106,7 @@ describe( table.WaitForTableEmpty(); agHelper.WaitUntilAllToastsDisappear(); - agHelper.RefreshPage("getConsolidatedData"); + agHelper.RefreshPage("viewPage"); agHelper.AssertElementVisibility(jsEditor._dialog("Confirmation dialog")); agHelper.AssertElementVisibility( jsEditor._dialogBody((jsName as string) + ".getEmployee"), diff --git a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js index 8a6a252774..be0510837d 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js +++ b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JSOnLoad_cyclic_dependency_errors_spec.js @@ -94,9 +94,9 @@ describe( // cy.get(widgetsPage.NavHomePage).click({ force: true }); cy.reload(); cy.openPropertyPane("inputwidgetv2"); - cy.wait("@getConsolidatedData").should( + cy.wait("@getPage").should( "have.nested.property", - "response.body.data.pageWithMigratedDsl.data.layouts[0].layoutOnLoadActionErrors.length", + "response.body.data.layouts[0].layoutOnLoadActionErrors.length", 0, ); diff --git a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JsOnLoad3_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JsOnLoad3_Spec.ts index f41ce9fbcb..268e41ddec 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JsOnLoad3_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/JsOnLoad3_Spec.ts @@ -153,7 +153,7 @@ describe( agHelper.AssertElementAbsence(jsEditor._dialogBody("WhatTrumpThinks")); //Since JS call is NO, dependent API confirmation should not appear - agHelper.RefreshPage("getConsolidatedData"); + agHelper.RefreshPage("viewPage"); // agHelper.AssertElementVisibility( // jsEditor._dialogBody((jsName as string) + ".callTrump"), // ); diff --git a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/OnLoadActions_Spec.ts b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/OnLoadActions_Spec.ts index 3d4b8004d6..816b86730c 100644 --- a/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/OnLoadActions_Spec.ts +++ b/app/client/cypress/e2e/Regression/ServerSide/OnLoadTests/OnLoadActions_Spec.ts @@ -1,7 +1,6 @@ import { agHelper, apiPage, - assertHelper, deployMode, entityExplorer, entityItems, @@ -138,19 +137,17 @@ describe( deployMode.DeployApp(locators._widgetInDeployed("textwidget"), false); agHelper.Sleep(5000); //for all api's to ccomplete call! - assertHelper.AssertNetworkStatus("@getConsolidatedData"); - - cy.get("@getConsolidatedData").then(($response: any) => { + cy.wait("@viewPage").then(($response) => { const respBody = JSON.stringify($response.response?.body); - const { pageWithMigratedDsl } = JSON.parse(respBody)?.data; + const _randomFlora = - pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[0]; + JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[0]; const _randomUser = - pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[1]; + JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[1]; const _genderize = - pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[2]; + JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[2]; const _suggestions = - pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[3]; + JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[3]; // cy.log("_randomFlora is: " + JSON.stringify(_randomFlora)) // cy.log("_randomUser is: " + JSON.stringify(_randomUser)) // cy.log("_genderize is: " + JSON.stringify(_genderize)) @@ -199,20 +196,17 @@ describe( }); // verifies Bug 10055 deployMode.DeployApp(locators._widgetInDeployed("textwidget"), false); - assertHelper.AssertNetworkStatus("@getConsolidatedData"); - - cy.get("@getConsolidatedData").then(($response: any) => { + agHelper.Sleep(5000); //for all api's to ccomplete call! + cy.wait("@viewPage").then(($response) => { const respBody = JSON.stringify($response.response?.body); - const { pageWithMigratedDsl } = JSON.parse(respBody)?.data; - const _randomFlora = - pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[0]; + JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[0]; const _randomUser = - pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[1]; + JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[1]; const _genderize = - pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[2]; + JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[2]; const _suggestions = - pageWithMigratedDsl.data.layouts[0].layoutOnLoadActions[3]; + JSON.parse(respBody).data.layouts[0].layoutOnLoadActions[3]; expect(JSON.parse(JSON.stringify(_randomFlora))[0]["name"]).to.eq( "RandomFlora", diff --git a/app/client/cypress/support/Objects/FeatureFlags.ts b/app/client/cypress/support/Objects/FeatureFlags.ts index 6f836a9e4b..edf30d44a4 100644 --- a/app/client/cypress/support/Objects/FeatureFlags.ts +++ b/app/client/cypress/support/Objects/FeatureFlags.ts @@ -1,4 +1,5 @@ -import produce from "immer"; +import { LICENSE_FEATURE_FLAGS } from "../Constants"; + export const featureFlagIntercept = ( flags: Record = {}, reload = true, @@ -12,33 +13,48 @@ export const featureFlagIntercept = ( ...flags, release_app_sidebar_enabled: true, release_show_new_sidebar_pages_pane_enabled: true, - rollout_consolidated_page_load_fetch_enabled: true, }, errorDisplay: "", }; cy.intercept("GET", "/api/v1/users/features", response); - - cy.intercept("GET", "/api/v1/consolidated-api/*?*", (req) => { - req.reply((res: any) => { - if (res.statusCode === 200) { - const originalResponse = res?.body; - const updatedResponse = produce(originalResponse, (draft: any) => { - draft.data.featureFlags.data = { ...flags }; - draft.data.featureFlags.data["release_app_sidebar_enabled"] = true; - draft.data.featureFlags.data[ - "release_show_new_sidebar_pages_pane_enabled" - ] = true; - draft.data.featureFlags.data[ - "rollout_consolidated_page_load_fetch_enabled" - ] = true; - }); - return res.send(updatedResponse); - } - }); - }).as("getConsolidatedData"); - if (reload) { cy.reload(); cy.wait(2000); //for the page to re-load finish for CI runs } }; + +export const featureFlagInterceptForLicenseFlags = () => { + cy.intercept( + { + method: "GET", + url: "/api/v1/users/features", + }, + (req) => { + req.reply((res) => { + if (res) { + const originalResponse = res.body; + let modifiedResponse: any = {}; + Object.keys(originalResponse.data).forEach((flag) => { + if (LICENSE_FEATURE_FLAGS.includes(flag)) { + modifiedResponse[flag] = originalResponse.data[flag]; + } + }); + modifiedResponse = { + ...modifiedResponse, + release_app_sidebar_enabled: true, + }; + res.send({ + responseMeta: { + status: 200, + success: true, + }, + data: { ...modifiedResponse }, + errorDisplay: "", + }); + } + }); + }, + ).as("getLicenseFeatures"); + cy.reload(); + cy.wait(2000); //for the page to re-load finish for CI runs +}; diff --git a/app/client/cypress/support/Pages/AggregateHelper.ts b/app/client/cypress/support/Pages/AggregateHelper.ts index de5f8d8987..86520dfae1 100644 --- a/app/client/cypress/support/Pages/AggregateHelper.ts +++ b/app/client/cypress/support/Pages/AggregateHelper.ts @@ -158,8 +158,8 @@ export class AggregateHelper { this.RefreshPage(); if (elementToCheckPresenceaftDslLoad) this.WaitUntilEleAppear(elementToCheckPresenceaftDslLoad); - // this.Sleep(5000); //settling time for dsl - this.assertHelper.AssertNetworkResponseData("@getConsolidatedData"); + //this.Sleep(2000); //settling time for dsl + this.assertHelper.AssertNetworkResponseData("@getPluginForm"); this.AssertElementAbsence(this.locator._loading); //Checks the spinner is gone & dsl loaded! this.AssertElementAbsence(this.locator._animationSpnner, 20000); //Checks page is loaded with dsl! }); diff --git a/app/client/cypress/support/Pages/DataSources.ts b/app/client/cypress/support/Pages/DataSources.ts index 8791d09a0c..21d92633e4 100644 --- a/app/client/cypress/support/Pages/DataSources.ts +++ b/app/client/cypress/support/Pages/DataSources.ts @@ -1008,7 +1008,7 @@ export class DataSources { else if (dsName == "MySQL") this.FillMySqlDSForm(); else if (dsName == "MongoDB") this.FillMongoDSForm(); this.TestSaveDatasource(true, true); - this.assertHelper.AssertNetworkStatus("@getConsolidatedData", 200); + this.assertHelper.AssertNetworkStatus("@getPage", 200); this.assertHelper.AssertNetworkStatus("getWorkspace"); } public ReconnectModalValidation( diff --git a/app/client/cypress/support/Pages/DeployModeHelper.ts b/app/client/cypress/support/Pages/DeployModeHelper.ts index 7e56217978..53c3e5f837 100644 --- a/app/client/cypress/support/Pages/DeployModeHelper.ts +++ b/app/client/cypress/support/Pages/DeployModeHelper.ts @@ -165,8 +165,8 @@ export class DeployMode { this.agHelper.AssertElementAbsence( this.locator._specificToast("Cannot read properties of undefined"), ); - this.assertHelper.AssertNetworkResponseData("@getConsolidatedData"); //for auth rest api - + this.assertHelper.AssertNetworkResponseData("@getPluginForm"); //for auth rest api + this.assertHelper.AssertNetworkResponseData("@getPluginForm"); //for graphql this.assertHelper.AssertNetworkStatus("@getWorkspace"); // cy.window().then((win) => { diff --git a/app/client/cypress/support/Pages/HomePage.ts b/app/client/cypress/support/Pages/HomePage.ts index 3d15e14183..9550b03e09 100644 --- a/app/client/cypress/support/Pages/HomePage.ts +++ b/app/client/cypress/support/Pages/HomePage.ts @@ -383,12 +383,12 @@ export class HomePage { this.agHelper.Sleep(); //waiting for window to load this.InvokeDispatchOnStore(); cy.wait("@postLogout"); - this.agHelper.VisitNAssert("/user/login", "getConsolidatedData"); + this.agHelper.VisitNAssert("/user/login", "signUpLogin"); this.agHelper.AssertElementVisibility(this._username); this.agHelper.TypeText(this._username, uname); this.agHelper.TypeText(this._password, pswd); this.agHelper.GetNClick(this._submitBtn); - this.assertHelper.AssertNetworkStatus("@getConsolidatedData"); + this.assertHelper.AssertNetworkStatus("@getMe"); this.agHelper.Sleep(3000); if (role != "App Viewer") { this.agHelper.AssertElementVisibility(this._homePageAppCreateBtn); @@ -401,7 +401,7 @@ export class HomePage { } public SignUp(uname: string, pswd: string) { - this.agHelper.VisitNAssert("/user/signup", "@getConsolidatedData"); + this.agHelper.VisitNAssert("/user/signup", "signUpLogin"); this.agHelper.AssertElementVisibility(this.signupUsername); this.agHelper.TypeText(this.signupUsername, uname); this.agHelper.TypeText(this._password, pswd); @@ -418,7 +418,7 @@ export class HomePage { ); } }); - this.assertHelper.AssertNetworkStatus("@getConsolidatedData"); + this.assertHelper.AssertNetworkStatus("@getMe"); this.agHelper.Sleep(3000); } @@ -451,7 +451,7 @@ export class HomePage { public LaunchAppFromAppHover() { cy.get(this._appHoverIcon("view")).should("be.visible").first().click(); this.agHelper.AssertElementAbsence(this.locator._loading); - this.assertHelper.AssertNetworkStatus("getConsolidatedData"); + this.assertHelper.AssertNetworkStatus("getPagesForViewApp"); } public EditAppFromAppHover(appName = "") { diff --git a/app/client/cypress/support/Pages/Table.ts b/app/client/cypress/support/Pages/Table.ts index 4bc93757b4..66659e0532 100644 --- a/app/client/cypress/support/Pages/Table.ts +++ b/app/client/cypress/support/Pages/Table.ts @@ -561,7 +561,7 @@ export class Table { col: number, expectedURL: string, tableVersion: "v1" | "v2" = "v1", - networkCall = "getConsolidatedData", + networkCall = "viewPage", ) { this.deployMode.StubWindowNAssert( this._tableRowColumnData(row, col, tableVersion), diff --git a/app/client/cypress/support/WorkspaceCommands.js b/app/client/cypress/support/WorkspaceCommands.js index c699b27342..1ee6aa7631 100644 --- a/app/client/cypress/support/WorkspaceCommands.js +++ b/app/client/cypress/support/WorkspaceCommands.js @@ -209,7 +209,7 @@ Cypress.Commands.add( Cypress.Commands.add("launchApp", () => { cy.get(homePage.appView).should("be.visible").first().click(); cy.get("#loading").should("not.exist"); - cy.wait("@getConsolidatedData").should( + cy.wait("@getPagesForViewApp").should( "have.nested.property", "response.body.responseMeta.status", 200, @@ -295,7 +295,8 @@ Cypress.Commands.add("CreateNewAppInNewWorkspace", () => { }); }); AppSidebar.assertVisible(); - assertHelper.AssertNetworkResponseData("@getConsolidatedData"); //for auth rest api + assertHelper.AssertNetworkResponseData("@getPluginForm"); //for auth rest api + assertHelper.AssertNetworkResponseData("@getPluginForm"); //for graphql // If the intro modal is open, close it cy.skipSignposting(); diff --git a/app/client/cypress/support/commands.js b/app/client/cypress/support/commands.js index 7917a65b9d..06f98facd5 100644 --- a/app/client/cypress/support/commands.js +++ b/app/client/cypress/support/commands.js @@ -280,12 +280,14 @@ Cypress.Commands.add("LogOutUser", () => { Cypress.Commands.add("LoginUser", (uname, pword, goToLoginPage = true) => { goToLoginPage && cy.visit("/user/login", { timeout: 60000 }); cy.wait(3000); //for login page to load fully for CI runs - cy.wait("@getConsolidatedData"); + cy.wait("@signUpLogin") + .its("response.body.responseMeta.status") + .should("eq", 200); cy.get(loginPage.username).should("be.visible"); cy.get(loginPage.username).type(uname); cy.get(loginPage.password).type(pword, { log: false }); cy.get(loginPage.submitBtn).click(); - cy.wait("@getConsolidatedData"); + cy.wait("@getMe"); cy.wait(3000); }); @@ -309,7 +311,7 @@ Cypress.Commands.add("Signup", (uname, pword) => { homePageTS.InvokeDispatchOnStore(); cy.wait("@postLogout"); cy.visit("/user/signup", { timeout: 60000 }); - cy.wait("@getConsolidatedData") + cy.wait("@signUpLogin") .its("response.body.responseMeta.status") .should("eq", 200); agHelper.WaitUntilEleAppear(signupPage.username); @@ -323,7 +325,7 @@ Cypress.Commands.add("Signup", (uname, pword) => { cy.get(signupPage.getStartedSubmit).click({ force: true }); } }); - cy.wait("@getConsolidatedData"); + cy.wait("@getMe"); cy.wait(3000); initLocalstorage(); }); @@ -370,7 +372,7 @@ Cypress.Commands.add("LoginFromAPI", (uname, pword) => { if (CURRENT_REPO === REPO.EE) { cy.wait(2000); } else { - assertHelper.AssertNetworkStatus("getConsolidatedData"); + assertHelper.AssertNetworkStatus("getMe"); assertHelper.AssertNetworkStatus("applications"); assertHelper.AssertNetworkStatus("getReleaseItems"); } @@ -414,7 +416,7 @@ Cypress.Commands.add("LogOut", (toCheckgetPluginForm = true) => { if (CURRENT_REPO === REPO.CE) toCheckgetPluginForm && - assertHelper.AssertNetworkResponseData("@getConsolidatedData", false); + assertHelper.AssertNetworkResponseData("@getPluginForm", false); cy.request({ method: httpMethod, diff --git a/app/client/cypress/support/e2e.js b/app/client/cypress/support/e2e.js index c47533aa64..dc16172de1 100644 --- a/app/client/cypress/support/e2e.js +++ b/app/client/cypress/support/e2e.js @@ -90,8 +90,7 @@ before(function () { window.indexedDB.deleteDatabase("Appsmith"); }); cy.visit("/setup/welcome", { timeout: 60000 }); - cy.wait("@getConsolidatedData"); - + cy.wait("@getMe"); cy.wait(2000); const username = Cypress.env("USERNAME"); const password = Cypress.env("PASSWORD"); diff --git a/app/client/src/actions/JSLibraryActions.ts b/app/client/src/actions/JSLibraryActions.ts index 23fd45dde4..6ab4709057 100644 --- a/app/client/src/actions/JSLibraryActions.ts +++ b/app/client/src/actions/JSLibraryActions.ts @@ -1,14 +1,10 @@ import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants"; -import type { ApiResponse } from "api/ApiResponses"; import type { JSLibrary } from "workers/common/JSLibrary"; -export function fetchJSLibraries( - applicationId: string, - customJSLibraries?: ApiResponse, -) { +export function fetchJSLibraries(applicationId: string) { return { type: ReduxActionTypes.FETCH_JS_LIBRARIES_INIT, - payload: { applicationId, customJSLibraries }, + payload: applicationId, }; } diff --git a/app/client/src/actions/appThemingActions.tsx b/app/client/src/actions/appThemingActions.tsx index b8edda5725..b0e211b651 100644 --- a/app/client/src/actions/appThemingActions.tsx +++ b/app/client/src/actions/appThemingActions.tsx @@ -1,7 +1,6 @@ import type { AppTheme } from "entities/AppTheming"; import type { AppThemingMode } from "selectors/appThemingSelectors"; import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants"; -import type { ApiResponse } from "api/ApiResponses"; /** * ---------------------------------------------------------------------------- @@ -11,12 +10,10 @@ import type { ApiResponse } from "api/ApiResponses"; export interface FetchAppThemesAction { applicationId: string; - themes?: ApiResponse; } export interface FetchSelectedAppThemeAction { applicationId: string; - currentTheme?: ApiResponse; } export interface UpdateSelectedAppThemeAction { @@ -68,14 +65,10 @@ export const setAppThemingModeStackAction = (stack: AppThemingMode[]) => ({ * @param mode * @returns */ -export const fetchAppThemesAction = ( - applicationId: string, - themes?: ApiResponse, -) => ({ +export const fetchAppThemesAction = (applicationId: string) => ({ type: ReduxActionTypes.FETCH_APP_THEMES_INIT, payload: { applicationId, - themes, }, }); @@ -85,14 +78,10 @@ export const fetchAppThemesAction = ( * @param mode * @returns */ -export const fetchSelectedAppThemeAction = ( - applicationId: string, - currentTheme?: ApiResponse, -) => ({ +export const fetchSelectedAppThemeAction = (applicationId: string) => ({ type: ReduxActionTypes.FETCH_SELECTED_APP_THEME_INIT, payload: { applicationId, - currentTheme, }, }); diff --git a/app/client/src/actions/authActions.ts b/app/client/src/actions/authActions.ts index 9f267837f3..9a431a9083 100644 --- a/app/client/src/actions/authActions.ts +++ b/app/client/src/actions/authActions.ts @@ -1,7 +1,5 @@ import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants"; -import type { ApiResponse } from "api/ApiResponses"; -export const getCurrentUser = (userProfile?: ApiResponse) => ({ +export const getCurrentUser = () => ({ type: ReduxActionTypes.FETCH_USER_INIT, - payload: { userProfile }, }); diff --git a/app/client/src/actions/datasourceActions.ts b/app/client/src/actions/datasourceActions.ts index e75a619d26..cc26d2fd1b 100644 --- a/app/client/src/actions/datasourceActions.ts +++ b/app/client/src/actions/datasourceActions.ts @@ -12,7 +12,7 @@ import type { MockDatasource, } from "entities/Datasource"; import type { PluginType } from "entities/Action"; -import type { ApiResponse, ResponseMeta } from "api/ApiResponses"; +import type { ResponseMeta } from "api/ApiResponses"; import { TEMP_DATASOURCE_ID } from "constants/Datasource"; export const createDatasourceFromForm = ( @@ -273,20 +273,16 @@ export const setDatasourceCollapsible = (key: string, isOpen: boolean) => { }; }; -export const fetchDatasources = (payload?: { - workspaceId?: string; - datasources?: ApiResponse; -}) => { +export const fetchDatasources = (payload?: { workspaceId?: string }) => { return { type: ReduxActionTypes.FETCH_DATASOURCES_INIT, payload, }; }; -export const fetchMockDatasources = (mockDatasources?: ApiResponse) => { +export const fetchMockDatasources = () => { return { type: ReduxActionTypes.FETCH_MOCK_DATASOURCES_INIT, - payload: { mockDatasources }, }; }; diff --git a/app/client/src/actions/initActions.ts b/app/client/src/actions/initActions.ts index 4f83f7e067..9f220f56f8 100644 --- a/app/client/src/actions/initActions.ts +++ b/app/client/src/actions/initActions.ts @@ -13,7 +13,6 @@ export interface InitializeEditorPayload { pageId?: string; branch?: string; mode: APP_MODE; - shouldInitialiseUserDetails?: boolean; } export const initEditor = ( @@ -28,7 +27,6 @@ export interface InitAppViewerPayload { applicationId?: string; pageId: string; mode: APP_MODE; - shouldInitialiseUserDetails?: boolean; } export const initAppViewer = ({ @@ -36,7 +34,6 @@ export const initAppViewer = ({ branch, mode, pageId, - shouldInitialiseUserDetails, }: InitAppViewerPayload) => ({ type: ReduxActionTypes.INITIALIZE_PAGE_VIEWER, payload: { @@ -44,7 +41,6 @@ export const initAppViewer = ({ applicationId, pageId, mode, - shouldInitialiseUserDetails, }, }); diff --git a/app/client/src/actions/jsActionActions.ts b/app/client/src/actions/jsActionActions.ts index 0b6e10185f..68a80427ff 100644 --- a/app/client/src/actions/jsActionActions.ts +++ b/app/client/src/actions/jsActionActions.ts @@ -9,23 +9,19 @@ import { import type { JSCollection } from "entities/JSCollection"; import type { CreateJSCollectionRequest } from "@appsmith/api/JSActionAPI"; import type { EventLocation } from "@appsmith/utils/analyticsUtilTypes"; -import type { ApiResponse } from "api/ApiResponses"; export interface FetchJSCollectionsPayload { applicationId: string; - publishedActionCollections?: ApiResponse; } export const fetchJSCollections = ({ applicationId, - unpublishedActionCollections, }: { applicationId: string; - unpublishedActionCollections?: ApiResponse; }): EvaluationReduxAction => { return { type: ReduxActionTypes.FETCH_JS_ACTIONS_INIT, - payload: { applicationId, unpublishedActionCollections }, + payload: { applicationId }, }; }; @@ -150,14 +146,12 @@ export const fetchJSCollectionsForPageError = () => { export const fetchJSCollectionsForView = ({ applicationId, - publishedActionCollections, }: { applicationId: string; - publishedActionCollections?: ApiResponse; }): ReduxAction => { return { type: ReduxActionTypes.FETCH_JS_ACTIONS_VIEW_MODE_INIT, - payload: { applicationId, publishedActionCollections }, + payload: { applicationId }, }; }; diff --git a/app/client/src/actions/pageActions.tsx b/app/client/src/actions/pageActions.tsx index acb4f29104..f083397d75 100644 --- a/app/client/src/actions/pageActions.tsx +++ b/app/client/src/actions/pageActions.tsx @@ -16,7 +16,6 @@ import AnalyticsUtil from "utils/AnalyticsUtil"; import type { WidgetOperation } from "widgets/BaseWidget"; import type { FetchPageRequest, - FetchPageResponse, PageLayout, SavePageResponse, UpdatePageRequest, @@ -549,21 +548,18 @@ export const resetApplicationWidgets = () => ({ type: ReduxActionTypes.RESET_APPLICATION_WIDGET_STATE_REQUEST, }); -export const fetchPageDSLs = (payload?: any) => ({ +export const fetchPageDSLs = () => ({ type: ReduxActionTypes.POPULATE_PAGEDSLS_INIT, - payload, }); export const setupPage = ( pageId: string, isFirstLoad = false, - pageWithMigratedDsl?: FetchPageResponse, ): ReduxAction => ({ type: ReduxActionTypes.SETUP_PAGE_INIT, payload: { id: pageId, isFirstLoad, - pageWithMigratedDsl, }, }); @@ -571,13 +567,11 @@ export const setupPublishedPage = ( pageId: string, bustCache = false, firstLoad = false, - pageWithMigratedDsl?: FetchPageResponse, ) => ({ type: ReduxActionTypes.SETUP_PUBLISHED_PAGE_INIT, payload: { pageId, bustCache, firstLoad, - pageWithMigratedDsl, }, }); diff --git a/app/client/src/actions/pluginActionActions.ts b/app/client/src/actions/pluginActionActions.ts index beadd5e464..063088d2d0 100644 --- a/app/client/src/actions/pluginActionActions.ts +++ b/app/client/src/actions/pluginActionActions.ts @@ -10,13 +10,11 @@ import { ReduxActionErrorTypes, ReduxActionTypes, } from "@appsmith/constants/ReduxActionConstants"; -import type { Action, ActionViewMode } from "entities/Action"; +import type { Action } from "entities/Action"; import { batchAction } from "actions/batchActions"; import type { ExecuteErrorPayload } from "constants/AppsmithActionConstants/ActionConstants"; import type { ModalInfo } from "reducers/uiReducers/modalActionReducer"; import type { OtlpSpan } from "UITelemetry/generateTraces"; -import type { ApiResponse } from "api/ApiResponses"; -import type { JSCollection } from "entities/JSCollection"; export const createActionRequest = (payload: Partial) => { return { @@ -34,36 +32,27 @@ export const createActionSuccess = (payload: Action) => { export interface FetchActionsPayload { applicationId: string; - publishedActions?: ApiResponse; - publishedActionCollections?: ApiResponse; - unpublishedActionCollections?: ApiResponse; - unpublishedActions?: ApiResponse; } export const fetchActions = ( - { - applicationId, - unpublishedActions, - }: { applicationId: string; unpublishedActions?: ApiResponse }, + { applicationId }: { applicationId: string }, postEvalActions: Array, ): EvaluationReduxAction => { return { type: ReduxActionTypes.FETCH_ACTIONS_INIT, - payload: { applicationId, unpublishedActions }, + payload: { applicationId }, postEvalActions, }; }; export const fetchActionsForView = ({ applicationId, - publishedActions, }: { applicationId: string; - publishedActions?: ApiResponse; }): ReduxAction => { return { type: ReduxActionTypes.FETCH_ACTIONS_VIEW_MODE_INIT, - payload: { applicationId, publishedActions }, + payload: { applicationId }, }; }; diff --git a/app/client/src/actions/pluginActions.ts b/app/client/src/actions/pluginActions.ts index 2639440463..8955651211 100644 --- a/app/client/src/actions/pluginActions.ts +++ b/app/client/src/actions/pluginActions.ts @@ -6,26 +6,18 @@ import { ReduxActionTypes, ReduxActionErrorTypes, } from "@appsmith/constants/ReduxActionConstants"; -import type { ApiResponse } from "api/ApiResponses"; import type { PluginFormPayload } from "api/PluginApi"; import type { DependencyMap } from "utils/DynamicBindingUtils"; -import type { Plugin } from "api/PluginApi"; export const fetchPlugins = (payload?: { workspaceId?: string; - plugins?: ApiResponse; }): ReduxAction<{ workspaceId?: string } | undefined> => ({ type: ReduxActionTypes.FETCH_PLUGINS_REQUEST, payload, }); -export const fetchPluginFormConfigs = ( - pluginFormConfigs?: ApiResponse[], -): ReduxAction<{ - pluginFormConfigs?: ApiResponse[]; -}> => ({ +export const fetchPluginFormConfigs = (): ReduxActionWithoutPayload => ({ type: ReduxActionTypes.FETCH_PLUGIN_FORM_CONFIGS_REQUEST, - payload: { pluginFormConfigs }, }); export interface PluginFormsPayload { diff --git a/app/client/src/actions/userActions.ts b/app/client/src/actions/userActions.ts index f0c265f903..f0b654684c 100644 --- a/app/client/src/actions/userActions.ts +++ b/app/client/src/actions/userActions.ts @@ -10,11 +10,9 @@ import type { } from "@appsmith/api/UserApi"; import type { FeatureFlags } from "@appsmith/entities/FeatureFlag"; import type { - ProductAlert, ProductAlertConfig, ProductAlertState, } from "reducers/uiReducers/usersReducer"; -import type { ApiResponse } from "api/ApiResponses"; export const logoutUser = (payload?: { redirectURL: string }) => ({ type: ReduxActionTypes.LOGOUT_USER_INIT, @@ -105,13 +103,8 @@ export const leaveWorkspace = (workspaceId: string) => { }; }; -export const fetchFeatureFlagsInit = ( - featureFlags?: ApiResponse, -) => ({ +export const fetchFeatureFlagsInit = () => ({ type: ReduxActionTypes.FETCH_FEATURE_FLAGS_INIT, - payload: { - featureFlags, - }, }); export const fetchFeatureFlagsSuccess = (payload: FeatureFlags) => ({ @@ -124,13 +117,8 @@ export const fetchFeatureFlagsError = (error: any) => ({ payload: { error, show: false }, }); -export const fetchProductAlertInit = ( - productAlert?: ApiResponse, -) => ({ +export const fetchProductAlertInit = () => ({ type: ReduxActionTypes.FETCH_PRODUCT_ALERT_INIT, - payload: { - productAlert, - }, }); export const fetchProductAlertSuccess = (productAlert: ProductAlertState) => ({ diff --git a/app/client/src/api/ConsolidatedPageLoadApi.tsx b/app/client/src/api/ConsolidatedPageLoadApi.tsx deleted file mode 100644 index ac4902e405..0000000000 --- a/app/client/src/api/ConsolidatedPageLoadApi.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import Api from "./Api"; -import type { AxiosPromise } from "axios"; -import type { ApiResponse } from "api/ApiResponses"; - -import type { InitConsolidatedApi } from "sagas/InitSagas"; - -class ConsolidatedPageLoadApi extends Api { - static url = "/v1/consolidated-api"; - - static async getConsolidatedPageLoadDataView(params: { - applicationId?: string; - defaultPageId?: string; - }): Promise>> { - return Api.get(ConsolidatedPageLoadApi.url + "/view", params); - } - static async getConsolidatedPageLoadDataEdit(params: { - applicationId?: string; - defaultPageId?: string; - }): Promise>> { - return Api.get(ConsolidatedPageLoadApi.url + "/edit", params); - } -} - -export default ConsolidatedPageLoadApi; diff --git a/app/client/src/api/PageApi.tsx b/app/client/src/api/PageApi.tsx index 8ae4b50a86..598434ccb6 100644 --- a/app/client/src/api/PageApi.tsx +++ b/app/client/src/api/PageApi.tsx @@ -18,7 +18,6 @@ export interface FetchPageRequest { isFirstLoad?: boolean; handleResponseLater?: boolean; migrateDSL?: boolean; - pageWithMigratedDsl?: FetchPageResponse; } export interface FetchPublishedPageRequest { diff --git a/app/client/src/ce/AppRouter.tsx b/app/client/src/ce/AppRouter.tsx index eabb607f57..d654adc46c 100644 --- a/app/client/src/ce/AppRouter.tsx +++ b/app/client/src/ce/AppRouter.tsx @@ -41,11 +41,13 @@ import ErrorPage from "pages/common/ErrorPage"; import PageNotFound from "pages/common/ErrorPages/PageNotFound"; import PageLoadingBar from "pages/common/PageLoadingBar"; import ErrorPageHeader from "pages/common/ErrorPageHeader"; -import { useDispatch, useSelector } from "react-redux"; +import type { AppState } from "@appsmith/reducers"; +import { connect, useSelector } from "react-redux"; import * as Sentry from "@sentry/react"; import { getSafeCrash, getSafeCrashCode } from "selectors/errorSelectors"; import UserProfile from "pages/UserProfile"; +import { getCurrentUser } from "actions/authActions"; import { getCurrentUserLoading, getFeatureFlagsFetching, @@ -55,6 +57,11 @@ import SettingsLoader from "pages/AdminSettings/loader"; import SignupSuccess from "pages/setup/SignupSuccess"; import type { ERROR_CODES } from "@appsmith/constants/ApiConstants"; import TemplatesListLoader from "pages/Templates/loader"; +import { + fetchFeatureFlagsInit, + fetchProductAlertInit, +} from "actions/userActions"; +import { getCurrentTenant } from "@appsmith/actions/tenantActions"; import { getCurrentUser as getCurrentUserSelector } from "selectors/usersSelectors"; import { getTenantPermissions, @@ -70,7 +77,6 @@ import { getAdminSettingsPath } from "@appsmith/utils/BusinessFeatures/adminSett import { useFeatureFlag } from "utils/hooks/useFeatureFlag"; import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag"; import CustomWidgetBuilderLoader from "pages/Editor/CustomWidgetBuilder/loader"; -import { getIsConsolidatedPageLoading } from "selectors/ui"; export const SentryRoute = Sentry.withSentryRouting(Route); @@ -153,53 +159,65 @@ export function Routes() { ); } -export default function AppRouter() { - const safeCrash: boolean = useSelector(getSafeCrash); - const safeCrashCode: ERROR_CODES | undefined = useSelector(getSafeCrashCode); +function AppRouter(props: { + safeCrash: boolean; + getCurrentUser: () => void; + getFeatureFlags: () => void; + getCurrentTenant: () => void; + initCurrentPage: () => void; + fetchProductAlert: () => void; + safeCrashCode?: ERROR_CODES; +}) { + const { + fetchProductAlert, + getCurrentTenant, + getCurrentUser, + getFeatureFlags, + initCurrentPage, + } = props; const tenantIsLoading = useSelector(isTenantLoading); const currentUserIsLoading = useSelector(getCurrentUserLoading); const featuresIsLoading = useSelector(getFeatureFlagsFetching); - const isConsolidatedPageLoading = useSelector(getIsConsolidatedPageLoading); - const dispatch = useDispatch(); - const isConsolidatedFetchEnabled = useFeatureFlag( - FEATURE_FLAG.rollout_consolidated_page_load_fetch_enabled, - ); useEffect(() => { - dispatch(initCurrentPage()); + getCurrentUser(); + getFeatureFlags(); + getCurrentTenant(); + initCurrentPage(); + fetchProductAlert(); }, []); useBrandingTheme(); - let isLoading: boolean; - if (isConsolidatedFetchEnabled) { - isLoading = isConsolidatedPageLoading; - } else { - isLoading = tenantIsLoading || currentUserIsLoading || featuresIsLoading; - } // hide the top loader once the tenant is loaded useEffect(() => { - if (!isLoading) { + if ( + tenantIsLoading === false && + currentUserIsLoading === false && + featuresIsLoading === false + ) { const loader = document.getElementById("loader") as HTMLDivElement; + if (loader) { loader.style.width = "100vw"; + setTimeout(() => { loader.style.opacity = "0"; }); } } - }, [isLoading]); + }, [tenantIsLoading, currentUserIsLoading, featuresIsLoading]); - if (isLoading) return null; + if (tenantIsLoading || currentUserIsLoading || featuresIsLoading) return null; return ( - {safeCrash && safeCrashCode ? ( + {props.safeCrash && props.safeCrashCode ? ( <> - + ) : ( <> @@ -214,3 +232,18 @@ export default function AppRouter() { ); } + +export const mapStateToProps = (state: AppState) => ({ + safeCrash: getSafeCrash(state), + safeCrashCode: getSafeCrashCode(state), +}); + +export const mapDispatchToProps = (dispatch: any) => ({ + getCurrentUser: () => dispatch(getCurrentUser()), + getFeatureFlags: () => dispatch(fetchFeatureFlagsInit()), + getCurrentTenant: () => dispatch(getCurrentTenant(false)), + initCurrentPage: () => dispatch(initCurrentPage()), + fetchProductAlert: () => dispatch(fetchProductAlertInit()), +}); + +export default connect(mapStateToProps, mapDispatchToProps)(AppRouter); diff --git a/app/client/src/ce/actions/tenantActions.ts b/app/client/src/ce/actions/tenantActions.ts index 157359411a..3ae7da6813 100644 --- a/app/client/src/ce/actions/tenantActions.ts +++ b/app/client/src/ce/actions/tenantActions.ts @@ -1,15 +1,10 @@ import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants"; import type { UpdateTenantConfigRequest } from "@appsmith/api/TenantApi"; -import type { ApiResponse } from "api/ApiResponses"; -export const getCurrentTenant = ( - isBackgroundRequest = true, - tenantConfig?: ApiResponse, -) => ({ +export const getCurrentTenant = (isBackgroundRequest = true) => ({ type: ReduxActionTypes.FETCH_CURRENT_TENANT_CONFIG, payload: { isBackgroundRequest, - tenantConfig, }, }); diff --git a/app/client/src/ce/api/ApplicationApi.tsx b/app/client/src/ce/api/ApplicationApi.tsx index 6aa6d4f169..e9f561787a 100644 --- a/app/client/src/ce/api/ApplicationApi.tsx +++ b/app/client/src/ce/api/ApplicationApi.tsx @@ -67,7 +67,6 @@ export interface ApplicationResponsePayload { export interface FetchApplicationPayload { applicationId?: string; pageId?: string; - pages?: FetchApplicationResponse; mode: APP_MODE; } diff --git a/app/client/src/ce/constants/ReduxActionConstants.tsx b/app/client/src/ce/constants/ReduxActionConstants.tsx index c43988581d..80693215db 100644 --- a/app/client/src/ce/constants/ReduxActionConstants.tsx +++ b/app/client/src/ce/constants/ReduxActionConstants.tsx @@ -923,8 +923,6 @@ const ActionTypes = { UPDATE_THEME_SETTING: "UPDATE_THEME_SETTING", SET_IDE_EDITOR_VIEW_MODE: "SET_IDE_EDITOR_VIEW_MODE", SET_IDE_EDITOR_PAGES_ACTIVE_STATUS: "SET_IDE_EDITOR_PAGES_ACTIVE_STATUS", - START_CONSOLIDATED_PAGE_LOAD: "START_CONSOLIDATED_PAGE_LOAD", - END_CONSOLIDATED_PAGE_LOAD: "END_CONSOLIDATED_PAGE_LOAD", }; export const ReduxActionTypes = { diff --git a/app/client/src/ce/entities/Engine/actionHelpers.ts b/app/client/src/ce/entities/Engine/actionHelpers.ts index 2dbdd4fdaf..ed3a4bfaa3 100644 --- a/app/client/src/ce/entities/Engine/actionHelpers.ts +++ b/app/client/src/ce/entities/Engine/actionHelpers.ts @@ -1,5 +1,4 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -import type { ReduxAction } from "@appsmith/constants/ReduxActionConstants"; import { ReduxActionErrorTypes, ReduxActionTypes, @@ -8,7 +7,6 @@ import type { DependentFeatureFlags } from "@appsmith/selectors/engineSelectors" import { fetchDatasources } from "actions/datasourceActions"; import { fetchPageDSLs } from "actions/pageActions"; import { fetchPlugins } from "actions/pluginActions"; -import type { EditConsolidatedApi } from "sagas/InitSagas"; export const CreateNewActionKey = { PAGE: "pageId", @@ -19,16 +17,10 @@ export const ActionParentEntityType = { } as const; export const getPageDependencyActions = ( - allResponses: EditConsolidatedApi, currentWorkspaceId: string = "", featureFlags: DependentFeatureFlags = {}, ) => { - const { datasources, pagesWithMigratedDsl, plugins } = allResponses || {}; - const initActions = [ - fetchPlugins({ plugins }), - fetchDatasources({ datasources }), - fetchPageDSLs({ pagesWithMigratedDsl }), - ] as Array>; + const initActions = [fetchPlugins(), fetchDatasources(), fetchPageDSLs()]; const successActions = [ ReduxActionTypes.FETCH_PLUGINS_SUCCESS, diff --git a/app/client/src/ce/entities/FeatureFlag.ts b/app/client/src/ce/entities/FeatureFlag.ts index 75e27cef50..3a65aac670 100644 --- a/app/client/src/ce/entities/FeatureFlag.ts +++ b/app/client/src/ce/entities/FeatureFlag.ts @@ -48,8 +48,6 @@ export const FEATURE_FLAG = { "ab_one_click_learning_popover_enabled", release_side_by_side_ide_enabled: "release_side_by_side_ide_enabled", release_global_add_pane_enabled: "release_global_add_pane_enabled", - rollout_consolidated_page_load_fetch_enabled: - "rollout_consolidated_page_load_fetch_enabled", } as const; export type FeatureFlag = keyof typeof FEATURE_FLAG; @@ -91,7 +89,6 @@ export const DEFAULT_FEATURE_FLAG_VALUE: FeatureFlags = { ab_one_click_learning_popover_enabled: false, release_side_by_side_ide_enabled: false, release_global_add_pane_enabled: false, - rollout_consolidated_page_load_fetch_enabled: false, }; export const AB_TESTING_EVENT_KEYS = { diff --git a/app/client/src/ce/reducers/index.tsx b/app/client/src/ce/reducers/index.tsx index 922e46a539..6213aed0eb 100644 --- a/app/client/src/ce/reducers/index.tsx +++ b/app/client/src/ce/reducers/index.tsx @@ -81,7 +81,6 @@ import type { IDEState } from "reducers/uiReducers/ideReducer"; or done so by a module that is designed to be eventually pluggable */ import type { LayoutElementPositionsReduxState } from "layoutSystems/anvil/integrations/reducers/layoutElementPositionsReducer"; import type { ActiveField } from "reducers/uiReducers/activeFieldEditorReducer"; -import type { ConsolidatedPageLoadState } from "reducers/uiReducers/consolidatedPageLoadReducer"; export const reducerObject = { entities: entityReducer, @@ -95,7 +94,6 @@ export const reducerObject = { export interface AppState { ui: { - consolidatedPageLoad: ConsolidatedPageLoadState; analytics: AnalyticsReduxState; editor: EditorReduxState; propertyPane: PropertyPaneReduxState; diff --git a/app/client/src/ce/reducers/uiReducers/index.tsx b/app/client/src/ce/reducers/uiReducers/index.tsx index 6d13d9e892..54c116a6ec 100644 --- a/app/client/src/ce/reducers/uiReducers/index.tsx +++ b/app/client/src/ce/reducers/uiReducers/index.tsx @@ -50,7 +50,6 @@ import layoutConversionReducer from "reducers/uiReducers/layoutConversionReducer import oneClickBindingReducer from "reducers/uiReducers/oneClickBindingReducer"; import activeFieldReducer from "reducers/uiReducers/activeFieldEditorReducer"; import ideReducer from "../../../reducers/uiReducers/ideReducer"; -import consolidatedPageLoadReducer from "reducers/uiReducers/consolidatedPageLoadReducer"; export const uiReducerObject = { analytics: analyticsReducer, @@ -105,5 +104,4 @@ export const uiReducerObject = { oneClickBinding: oneClickBindingReducer, activeField: activeFieldReducer, ide: ideReducer, - consolidatedPageLoad: consolidatedPageLoadReducer, }; diff --git a/app/client/src/ce/sagas/ApplicationSagas.tsx b/app/client/src/ce/sagas/ApplicationSagas.tsx index c1e485b366..8a37dfedef 100644 --- a/app/client/src/ce/sagas/ApplicationSagas.tsx +++ b/app/client/src/ce/sagas/ApplicationSagas.tsx @@ -136,7 +136,6 @@ import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelector import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag"; import { LayoutSystemTypes } from "layoutSystems/types"; import equal from "fast-deep-equal"; -import { getFromServerWhenNoPrefetchedResult } from "sagas/helper"; export const getDefaultPageId = ( pages?: ApplicationPagePayload[], @@ -269,20 +268,18 @@ export function* getAllApplicationSaga() { }); } } -// v1 + export function* fetchAppAndPagesSaga( action: ReduxAction, ) { try { - const { pages, ...payload } = action.payload; - const params = pickBy(payload, identity); + const params = pickBy(action.payload, identity); if (params.pageId && params.applicationId) { delete params.applicationId; } const response: FetchApplicationResponse = yield call( - getFromServerWhenNoPrefetchedResult, - pages, - () => call(PageApi.fetchAppAndPages, params), + PageApi.fetchAppAndPages, + params, ); const isValidResponse: boolean = yield call(validateResponse, response); if (isValidResponse) { diff --git a/app/client/src/ce/sagas/JSActionSagas.ts b/app/client/src/ce/sagas/JSActionSagas.ts index 8676857d4f..bbb8c7cc53 100644 --- a/app/client/src/ce/sagas/JSActionSagas.ts +++ b/app/client/src/ce/sagas/JSActionSagas.ts @@ -63,10 +63,7 @@ import { } from "@appsmith/RouteBuilder"; import type { EventLocation } from "@appsmith/utils/analyticsUtilTypes"; import AnalyticsUtil from "utils/AnalyticsUtil"; -import { - checkAndLogErrorsIfCyclicDependency, - getFromServerWhenNoPrefetchedResult, -} from "../../sagas/helper"; +import { checkAndLogErrorsIfCyclicDependency } from "../../sagas/helper"; import { toast } from "design-system"; import { updateAndSaveLayout } from "actions/pageActions"; import type { CanvasWidgetsReduxState } from "reducers/entityReducers/canvasWidgetsReducer"; @@ -82,14 +79,9 @@ import type { JSCollectionDataState } from "@appsmith/reducers/entityReducers/js export function* fetchJSCollectionsSaga( action: EvaluationReduxAction, ) { - const { unpublishedActionCollections, ...payload } = action.payload; try { - const response: ApiResponse = yield call( - getFromServerWhenNoPrefetchedResult, - unpublishedActionCollections, - async () => JSActionAPI.fetchJSCollections(payload), - ); - + const response: ApiResponse = + yield JSActionAPI.fetchJSCollections(action.payload); yield put({ type: ReduxActionTypes.FETCH_JS_ACTIONS_SUCCESS, payload: response.data || [], @@ -503,15 +495,10 @@ export function* fetchJSCollectionsForPageSaga( export function* fetchJSCollectionsForViewModeSaga( action: ReduxAction, ) { - const { applicationId, publishedActionCollections } = action.payload; - + const { applicationId } = action.payload; try { - const response: ApiResponse = yield call( - getFromServerWhenNoPrefetchedResult, - publishedActionCollections, - async () => JSActionAPI.fetchJSCollectionsForViewMode(applicationId), - ); - + const response: ApiResponse = + yield JSActionAPI.fetchJSCollectionsForViewMode(applicationId); const resultJSCollections = response.data; const isValidResponse: boolean = yield validateResponse(response); if (isValidResponse) { diff --git a/app/client/src/ce/sagas/PageSagas.tsx b/app/client/src/ce/sagas/PageSagas.tsx index 159a11b982..1e47763d80 100644 --- a/app/client/src/ce/sagas/PageSagas.tsx +++ b/app/client/src/ce/sagas/PageSagas.tsx @@ -41,7 +41,6 @@ import type { FetchPageListResponse, FetchPageRequest, FetchPageResponse, - FetchPageResponseData, FetchPublishedPageRequest, GenerateTemplatePageRequest, PageLayout, @@ -124,10 +123,7 @@ import { waitForWidgetConfigBuild, } from "../../sagas/InitSagas"; import { resizePublishedMainCanvasToLowestWidget } from "../../sagas/WidgetOperationUtils"; -import { - checkAndLogErrorsIfCyclicDependency, - getFromServerWhenNoPrefetchedResult, -} from "../../sagas/helper"; +import { checkAndLogErrorsIfCyclicDependency } from "../../sagas/helper"; import { LOCAL_STORAGE_KEYS } from "utils/localStorage"; import { generateAutoHeightLayoutTreeAction } from "actions/autoHeightActions"; import { getUsedActionNames } from "selectors/actionSelectors"; @@ -379,23 +375,22 @@ export function* fetchPageSaga( pageRequestAction: ReduxAction, ) { try { - const { id, isFirstLoad, pageWithMigratedDsl } = pageRequestAction.payload; + const { id, isFirstLoad } = pageRequestAction.payload; PerformanceTracker.startAsyncTracking( PerformanceTransactionName.FETCH_PAGE_API, { pageId: id }, ); + const isServerDSLMigrationsEnabled = select( getIsServerDSLMigrationsEnabled, ); - const params: FetchPageRequest = { id }; if (isServerDSLMigrationsEnabled) { params.migrateDSL = true; } const fetchPageResponse: FetchPageResponse = yield call( - getFromServerWhenNoPrefetchedResult, - pageWithMigratedDsl, - () => call(PageApi.fetchPage, params), + PageApi.fetchPage, + params, ); yield handleFetchedPage({ @@ -429,12 +424,10 @@ export function* fetchPublishedPageSaga( pageId: string; bustCache: boolean; firstLoad: boolean; - pageWithMigratedDsl?: FetchPageResponse; }>, ) { try { - const { bustCache, firstLoad, pageId, pageWithMigratedDsl } = - pageRequestAction.payload; + const { bustCache, firstLoad, pageId } = pageRequestAction.payload; PerformanceTracker.startAsyncTracking( PerformanceTransactionName.FETCH_PAGE_API, { @@ -446,13 +439,10 @@ export function* fetchPublishedPageSaga( pageId, bustCache, }; - const response: FetchPageResponse = yield call( - getFromServerWhenNoPrefetchedResult, - pageWithMigratedDsl, - () => call(PageApi.fetchPublishedPage, request), + PageApi.fetchPublishedPage, + request, ); - const isValidResponse: boolean = yield validateResponse(response); if (isValidResponse) { // Clear any existing caches @@ -1199,10 +1189,7 @@ export function* setDataUrl() { yield put(setUrlData(urlData)); } -export function* fetchPageDSLSaga( - pageId: string, - pageDSL?: ApiResponse, -) { +export function* fetchPageDSLSaga(pageId: string) { try { const layoutSystemType: LayoutSystemTypes = yield select(getLayoutSystemType); @@ -1220,11 +1207,9 @@ export function* fetchPageDSLSaga( params.migrateDSL = true; } const fetchPageResponse: FetchPageResponse = yield call( - getFromServerWhenNoPrefetchedResult, - pageDSL, - () => call(PageApi.fetchPage, params), + PageApi.fetchPage, + params, ); - const isValidResponse: boolean = yield validateResponse(fetchPageResponse); if (isValidResponse) { // Wait for the Widget config to be loaded before we can migrate the DSL @@ -1264,25 +1249,14 @@ export function* fetchPageDSLSaga( } } -export function* populatePageDSLsSaga(action?: { - payload?: { pagesWithMigratedDsl?: ApiResponse }; -}) { - const { pagesWithMigratedDsl } = action?.payload || {}; +export function* populatePageDSLsSaga() { try { const pageIds: string[] = yield select((state: AppState) => state.entities.pageList.pages.map((page: Page) => page.pageId), ); const pageDSLs: unknown = yield all( pageIds.map((pageId: string) => { - if (!pagesWithMigratedDsl) { - return call(fetchPageDSLSaga, pageId); - } - const { data } = pagesWithMigratedDsl; - const v1PageDSL = data?.find?.((v: any) => v?.id === pageId); - return call(fetchPageDSLSaga, pageId, { - ...pagesWithMigratedDsl, - data: v1PageDSL, - } as ApiResponse); + return call(fetchPageDSLSaga, pageId); }), ); yield put({ @@ -1463,11 +1437,11 @@ export function* setPreviewModeInitSaga(action: ReduxAction) { export function* setupPageSaga(action: ReduxAction) { try { - const { id, isFirstLoad, pageWithMigratedDsl } = action.payload; + const { id, isFirstLoad } = action.payload; yield call(fetchPageSaga, { type: ReduxActionTypes.FETCH_PAGE_INIT, - payload: { id, isFirstLoad, pageWithMigratedDsl }, + payload: { id, isFirstLoad }, }); yield put({ @@ -1486,16 +1460,14 @@ export function* setupPublishedPageSaga( pageId: string; bustCache: boolean; firstLoad: boolean; - pageWithMigratedDsl?: FetchPageResponse; }>, ) { try { - const { bustCache, firstLoad, pageId, pageWithMigratedDsl } = - action.payload; + const { bustCache, firstLoad, pageId } = action.payload; yield call(fetchPublishedPageSaga, { type: ReduxActionTypes.FETCH_PUBLISHED_PAGE_INIT, - payload: { bustCache, firstLoad, pageId, pageWithMigratedDsl }, + payload: { bustCache, firstLoad, pageId }, }); yield put({ diff --git a/app/client/src/ce/sagas/tenantSagas.tsx b/app/client/src/ce/sagas/tenantSagas.tsx index 9bf9969bd0..c197e3df13 100644 --- a/app/client/src/ce/sagas/tenantSagas.tsx +++ b/app/client/src/ce/sagas/tenantSagas.tsx @@ -13,20 +13,13 @@ import { ERROR_CODES } from "@appsmith/constants/ApiConstants"; import { defaultBrandingConfig as CE_defaultBrandingConfig } from "@appsmith/reducers/tenantReducer"; import { toast } from "design-system"; import AnalyticsUtil from "utils/AnalyticsUtil"; -import { getFromServerWhenNoPrefetchedResult } from "sagas/helper"; // On CE we don't expose tenant config so this shouldn't make any API calls and should just return necessary permissions for the user -export function* fetchCurrentTenantConfigSaga(action?: { - payload?: { tenantConfig?: ApiResponse }; -}) { - const tenantConfig = action?.payload?.tenantConfig; +export function* fetchCurrentTenantConfigSaga() { try { const response: ApiResponse = yield call( - getFromServerWhenNoPrefetchedResult, - tenantConfig, - () => call(TenantApi.fetchCurrentTenantConfig), + TenantApi.fetchCurrentTenantConfig, ); - const isValidResponse: boolean = yield validateResponse(response); if (isValidResponse) { const data: any = response.data; diff --git a/app/client/src/ce/sagas/userSagas.tsx b/app/client/src/ce/sagas/userSagas.tsx index dc84d0f5b2..c8b7a91c6a 100644 --- a/app/client/src/ce/sagas/userSagas.tsx +++ b/app/client/src/ce/sagas/userSagas.tsx @@ -90,7 +90,6 @@ import type { ProductAlertConfig, } from "reducers/uiReducers/usersReducer"; import { selectFeatureFlags } from "@appsmith/selectors/featureFlagsSelectors"; -import { getFromServerWhenNoPrefetchedResult } from "sagas/helper"; export function* createUserSaga( action: ReduxActionWithPromise, @@ -149,19 +148,12 @@ export function* waitForSegmentInit(skipWithAnonymousId: boolean) { } } -export function* getCurrentUserSaga(action?: { - payload?: { userProfile?: ApiResponse }; -}) { - const userProfile = action?.payload?.userProfile; +export function* getCurrentUserSaga() { try { PerformanceTracker.startAsyncTracking( PerformanceTransactionName.USER_ME_API, ); - const response: ApiResponse = yield call( - getFromServerWhenNoPrefetchedResult, - userProfile, - () => call(UserApi.getCurrentUser), - ); + const response: ApiResponse = yield call(UserApi.getCurrentUser); const isValidResponse: boolean = yield validateResponse(response); @@ -542,17 +534,11 @@ export function* updatePhoto( } } -export function* fetchFeatureFlags(action?: { - payload?: { featureFlags?: ApiResponse }; -}) { - const featureFlags = action?.payload?.featureFlags; +export function* fetchFeatureFlags() { try { const response: ApiResponse = yield call( - getFromServerWhenNoPrefetchedResult, - featureFlags, - () => call(UserApi.fetchFeatureFlags), + UserApi.fetchFeatureFlags, ); - const isValidResponse: boolean = yield validateResponse(response); if (isValidResponse) { yield put( @@ -608,17 +594,11 @@ export function* leaveWorkspaceSaga( } } -export function* fetchProductAlertSaga(action?: { - payload?: { productAlert?: ApiResponse }; -}) { - const productAlert = action?.payload?.productAlert; +export function* fetchProductAlertSaga() { try { const response: ApiResponse = yield call( - getFromServerWhenNoPrefetchedResult, - productAlert, - () => call(UserApi.getProductAlert), + UserApi.getProductAlert, ); - const isValidResponse: boolean = yield validateResponse(response); if (isValidResponse) { const message = response.data; diff --git a/app/client/src/entities/Engine/AppEditorEngine.ts b/app/client/src/entities/Engine/AppEditorEngine.ts index 0d71f11334..ddb46f18e9 100644 --- a/app/client/src/entities/Engine/AppEditorEngine.ts +++ b/app/client/src/entities/Engine/AppEditorEngine.ts @@ -18,7 +18,10 @@ import { fetchActions, } from "actions/pluginActionActions"; import { fetchPluginFormConfigs } from "actions/pluginActions"; -import type { ApplicationPayload } from "@appsmith/constants/ReduxActionConstants"; +import type { + ApplicationPayload, + ReduxAction, +} from "@appsmith/constants/ReduxActionConstants"; import { ReduxActionErrorTypes, ReduxActionTypes, @@ -26,7 +29,6 @@ import { import { addBranchParam } from "constants/routes"; import type { APP_MODE } from "entities/App"; import { call, fork, put, select, spawn } from "redux-saga/effects"; -import type { EditConsolidatedApi } from "sagas/InitSagas"; import { failFastApiCalls, reportSWStatus, @@ -61,16 +63,16 @@ import { trackOpenEditorTabs } from "../../utils/editor/browserTabsTracking"; import { EditorModes } from "components/editorComponents/CodeEditor/EditorConfig"; import { waitForFetchEnvironments } from "@appsmith/sagas/EnvironmentSagas"; import { getPageDependencyActions } from "@appsmith/entities/Engine/actionHelpers"; -import { fetchJSCollections } from "actions/jsActionActions"; -import { - fetchAppThemesAction, - fetchSelectedAppThemeAction, -} from "actions/appThemingActions"; import { getCurrentWorkspaceId } from "@appsmith/selectors/workspaceSelectors"; import { getFeatureFlagsForEngine, type DependentFeatureFlags, } from "@appsmith/selectors/engineSelectors"; +import { fetchJSCollections } from "actions/jsActionActions"; +import { + fetchAppThemesAction, + fetchSelectedAppThemeAction, +} from "actions/appThemingActions"; export default class AppEditorEngine extends AppEngine { constructor(mode: APP_MODE) { @@ -113,22 +115,13 @@ export default class AppEditorEngine extends AppEngine { private *loadPageThemesAndActions( toLoadPageId: string, applicationId: string, - allResponses: EditConsolidatedApi, ) { - const { - currentTheme, - customJSLibraries, - pageWithMigratedDsl, - themes, - unpublishedActionCollections, - unpublishedActions, - } = allResponses; const initActionsCalls = [ - setupPage(toLoadPageId, true, pageWithMigratedDsl), - fetchActions({ applicationId, unpublishedActions }, []), - fetchJSCollections({ applicationId, unpublishedActionCollections }), - fetchSelectedAppThemeAction(applicationId, currentTheme), - fetchAppThemesAction(applicationId, themes), + setupPage(toLoadPageId, true), + fetchActions({ applicationId }, []), + fetchJSCollections({ applicationId }), + fetchSelectedAppThemeAction(applicationId), + fetchAppThemesAction(applicationId), ]; const successActionEffects = [ @@ -147,7 +140,7 @@ export default class AppEditorEngine extends AppEngine { ReduxActionErrorTypes.SETUP_PAGE_ERROR, ]; - initActionsCalls.push(fetchJSLibraries(applicationId, customJSLibraries)); + initActionsCalls.push(fetchJSLibraries(applicationId)); successActionEffects.push(ReduxActionTypes.FETCH_JS_LIBRARIES_SUCCESS); const allActionCalls: boolean = yield call( @@ -168,19 +161,17 @@ export default class AppEditorEngine extends AppEngine { yield put(fetchAllPageEntityCompletion([executePageLoadActions()])); } - private *loadPluginsAndDatasources(allResponses: EditConsolidatedApi) { + private *loadPluginsAndDatasources() { const isAirgappedInstance = isAirgapped(); const currentWorkspaceId: string = yield select(getCurrentWorkspaceId); const featureFlags: DependentFeatureFlags = yield select( getFeatureFlagsForEngine, ); - const { mockDatasources, pluginFormConfigs } = allResponses || {}; - const { errorActions, initActions, successActions } = - getPageDependencyActions(allResponses, currentWorkspaceId, featureFlags); + getPageDependencyActions(currentWorkspaceId, featureFlags); if (!isAirgappedInstance) { - initActions.push(fetchMockDatasources(mockDatasources)); + initActions.push(fetchMockDatasources() as ReduxAction<{ type: string }>); successActions.push(ReduxActionTypes.FETCH_MOCK_DATASOURCES_SUCCESS); errorActions.push(ReduxActionErrorTypes.FETCH_MOCK_DATASOURCES_ERROR); } @@ -197,7 +188,7 @@ export default class AppEditorEngine extends AppEngine { const pluginFormCall: boolean = yield call( failFastApiCalls, - [fetchPluginFormConfigs(pluginFormConfigs)], + [fetchPluginFormConfigs()], [ReduxActionTypes.FETCH_PLUGIN_FORM_CONFIGS_SUCCESS], [ReduxActionErrorTypes.FETCH_PLUGIN_FORM_CONFIGS_ERROR], ); @@ -207,18 +198,9 @@ export default class AppEditorEngine extends AppEngine { ); } - public *loadAppEntities( - toLoadPageId: string, - applicationId: string, - allResponses: EditConsolidatedApi, - ): any { - yield call( - this.loadPageThemesAndActions, - toLoadPageId, - applicationId, - allResponses, - ); - yield call(this.loadPluginsAndDatasources, allResponses); + public *loadAppEntities(toLoadPageId: string, applicationId: string): any { + yield call(this.loadPageThemesAndActions, toLoadPageId, applicationId); + yield call(this.loadPluginsAndDatasources); } public *completeChore() { diff --git a/app/client/src/entities/Engine/AppViewerEngine.ts b/app/client/src/entities/Engine/AppViewerEngine.ts index b67a87267f..0f238ce8c2 100644 --- a/app/client/src/entities/Engine/AppViewerEngine.ts +++ b/app/client/src/entities/Engine/AppViewerEngine.ts @@ -12,7 +12,6 @@ import { } from "@appsmith/constants/ReduxActionConstants"; import type { APP_MODE } from "entities/App"; import { call, put, spawn } from "redux-saga/effects"; -import type { DeployConsolidatedApi } from "sagas/InitSagas"; import { failFastApiCalls, reportSWStatus, @@ -55,6 +54,11 @@ export default class AppViewerEngine extends AppEngine { yield put({ type: ReduxActionTypes.INITIALIZE_PAGE_VIEWER_SUCCESS, }); + if ("serviceWorker" in navigator) { + yield put({ + type: ReduxActionTypes.FETCH_ALL_PUBLISHED_PAGES, + }); + } yield spawn(reportSWStatus); } @@ -74,28 +78,13 @@ export default class AppViewerEngine extends AppEngine { ); } - *loadAppEntities( - toLoadPageId: string, - applicationId: string, - allResponses: DeployConsolidatedApi, - ): any { - const { - currentTheme, - customJSLibraries, - pageWithMigratedDsl, - publishedActionCollections, - publishedActions, - themes, - } = allResponses; + *loadAppEntities(toLoadPageId: string, applicationId: string): any { const initActionsCalls: any = [ - fetchActionsForView({ applicationId, publishedActions }), - fetchJSCollectionsForView({ - applicationId, - publishedActionCollections, - }), - fetchSelectedAppThemeAction(applicationId, currentTheme), - fetchAppThemesAction(applicationId, themes), - setupPublishedPage(toLoadPageId, true, true, pageWithMigratedDsl), + fetchActionsForView({ applicationId }), + fetchJSCollectionsForView({ applicationId }), + fetchSelectedAppThemeAction(applicationId), + fetchAppThemesAction(applicationId), + setupPublishedPage(toLoadPageId, true, true), ]; const successActionEffects = [ @@ -113,7 +102,7 @@ export default class AppViewerEngine extends AppEngine { ReduxActionErrorTypes.SETUP_PUBLISHED_PAGE_ERROR, ]; - initActionsCalls.push(fetchJSLibraries(applicationId, customJSLibraries)); + initActionsCalls.push(fetchJSLibraries(applicationId)); successActionEffects.push(ReduxActionTypes.FETCH_JS_LIBRARIES_SUCCESS); failureActionEffects.push(ReduxActionErrorTypes.FETCH_JS_LIBRARIES_FAILED); diff --git a/app/client/src/entities/Engine/index.ts b/app/client/src/entities/Engine/index.ts index ff1cb49ec8..50e05f5f2f 100644 --- a/app/client/src/entities/Engine/index.ts +++ b/app/client/src/entities/Engine/index.ts @@ -9,7 +9,6 @@ import { getPersistentAppStore } from "constants/AppConstants"; import type { APP_MODE } from "entities/App"; import log from "loglevel"; import { call, put, select } from "redux-saga/effects"; -import type { InitConsolidatedApi } from "sagas/InitSagas"; import { failFastApiCalls } from "sagas/InitSagas"; import { getDefaultPageId } from "sagas/selectors"; import { getCurrentApplication } from "@appsmith/selectors/applicationSelectors"; @@ -24,7 +23,6 @@ export interface AppEnginePayload { pageId?: string; branch?: string; mode: APP_MODE; - shouldInitialiseUserDetails?: boolean; } export interface IAppEngine { @@ -50,28 +48,16 @@ export default abstract class AppEngine { } private _urlRedirect: URLRedirect | null; - abstract loadAppEntities( - toLoadPageId: string, - applicationId: string, - allResponses: InitConsolidatedApi, - ): any; + abstract loadAppEntities(toLoadPageId: string, applicationId: string): any; abstract loadGit(applicationId: string): any; abstract startPerformanceTracking(): any; abstract stopPerformanceTracking(): any; abstract completeChore(): any; - *loadAppData(payload: AppEnginePayload, allResponses: InitConsolidatedApi) { + *loadAppData(payload: AppEnginePayload) { const { applicationId, branch, pageId } = payload; - const { pages } = allResponses; const apiCalls: boolean = yield failFastApiCalls( - [ - fetchApplication({ - applicationId, - pageId, - mode: this._mode, - pages, - }), - ], + [fetchApplication({ applicationId, pageId, mode: this._mode })], [ ReduxActionTypes.FETCH_APPLICATION_SUCCESS, ReduxActionTypes.FETCH_PAGE_LIST_SUCCESS, diff --git a/app/client/src/reducers/uiReducers/consolidatedPageLoadReducer.ts b/app/client/src/reducers/uiReducers/consolidatedPageLoadReducer.ts deleted file mode 100644 index 5f9cf1b266..0000000000 --- a/app/client/src/reducers/uiReducers/consolidatedPageLoadReducer.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { createReducer } from "utils/ReducerUtils"; -import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants"; - -const initialState: ConsolidatedPageLoadState = { - isLoading: true, -}; - -const consolidatedPageLoadReducer = createReducer(initialState, { - [ReduxActionTypes.START_CONSOLIDATED_PAGE_LOAD]: () => ({ - isLoading: true, - }), - [ReduxActionTypes.END_CONSOLIDATED_PAGE_LOAD]: () => ({ - isLoading: false, - }), -}); - -export interface ConsolidatedPageLoadState { - isLoading: boolean; -} - -export default consolidatedPageLoadReducer; diff --git a/app/client/src/sagas/ActionSagas.ts b/app/client/src/sagas/ActionSagas.ts index 5622fb1ef5..430a10a075 100644 --- a/app/client/src/sagas/ActionSagas.ts +++ b/app/client/src/sagas/ActionSagas.ts @@ -117,7 +117,6 @@ import { RequestPayloadAnalyticsPath, checkAndLogErrorsIfCyclicDependency, enhanceRequestPayloadWithEventData, - getFromServerWhenNoPrefetchedResult, } from "./helper"; import { setSnipingMode as setSnipingModeAction } from "actions/propertyPaneActions"; import { toast } from "design-system"; @@ -311,18 +310,15 @@ export function* fetchActionDatasourceStructure( export function* fetchActionsSaga( action: EvaluationReduxAction, ) { - const { applicationId, unpublishedActions } = action.payload; + const { applicationId } = action.payload; PerformanceTracker.startAsyncTracking( PerformanceTransactionName.FETCH_ACTIONS_API, { mode: "EDITOR", appId: applicationId }, ); try { - const response: ApiResponse = yield call( - getFromServerWhenNoPrefetchedResult, - unpublishedActions, - async () => ActionAPI.fetchActions({ applicationId }), - ); - + const response: ApiResponse = yield ActionAPI.fetchActions({ + applicationId, + }); const isValidResponse: boolean = yield validateResponse(response); if (isValidResponse) { yield put({ @@ -349,18 +345,14 @@ export function* fetchActionsSaga( export function* fetchActionsForViewModeSaga( action: ReduxAction, ) { - const { applicationId, publishedActions } = action.payload; + const { applicationId } = action.payload; PerformanceTracker.startAsyncTracking( PerformanceTransactionName.FETCH_ACTIONS_API, { mode: "VIEWER", appId: applicationId }, ); try { - const response: ApiResponse = yield call( - getFromServerWhenNoPrefetchedResult, - publishedActions, - async () => ActionAPI.fetchActionsForViewMode(applicationId), - ); - + const response: ApiResponse = + yield ActionAPI.fetchActionsForViewMode(applicationId); const isValidResponse: boolean = yield validateResponse(response); if (isValidResponse) { const correctFormatResponse = response.data.map((action) => { diff --git a/app/client/src/sagas/AppThemingSaga.tsx b/app/client/src/sagas/AppThemingSaga.tsx index 3eb1f5c9f0..3855bc7f6a 100644 --- a/app/client/src/sagas/AppThemingSaga.tsx +++ b/app/client/src/sagas/AppThemingSaga.tsx @@ -13,7 +13,7 @@ import { ReduxActionTypes, } from "@appsmith/constants/ReduxActionConstants"; import ThemingApi from "api/AppThemingApi"; -import { all, takeLatest, put, select, call } from "redux-saga/effects"; +import { all, takeLatest, put, select } from "redux-saga/effects"; import { toast } from "design-system"; import { CHANGE_APP_THEME, @@ -46,7 +46,6 @@ import { Severity } from "@sentry/react"; import { getAllPageIds } from "./selectors"; import type { SagaIterator } from "@redux-saga/types"; import type { AxiosPromise } from "axios"; -import { getFromServerWhenNoPrefetchedResult } from "./helper"; /** * init app theming @@ -74,13 +73,9 @@ export function* initAppTheming() { // eslint-disable-next-line export function* fetchAppThemes(action: ReduxAction) { try { - const { applicationId, themes } = action.payload; - - const response: ApiResponse = yield call( - getFromServerWhenNoPrefetchedResult, - themes, - async () => ThemingApi.fetchThemes(applicationId), - ); + const { applicationId } = action.payload; + const response: ApiResponse = + yield ThemingApi.fetchThemes(applicationId); yield put({ type: ReduxActionTypes.FETCH_APP_THEMES_SUCCESS, @@ -104,19 +99,18 @@ export function* fetchAppSelectedTheme( // eslint-disable-next-line action: ReduxAction, ): SagaIterator | AxiosPromise { - const { applicationId, currentTheme } = action.payload; + const { applicationId } = action.payload; const mode: APP_MODE = yield select(getAppMode); const pageIds = yield select(getAllPageIds); const userDetails = yield select(getCurrentUser); const applicationVersion = yield select(selectApplicationVersion); try { - const response: ApiResponse = yield call( - getFromServerWhenNoPrefetchedResult, - currentTheme, - async () => ThemingApi.fetchSelected(applicationId, mode), + // eslint-disable-next-line + const response: ApiResponse = yield ThemingApi.fetchSelected( + applicationId, + mode, ); - if (response?.data) { yield put({ type: ReduxActionTypes.FETCH_SELECTED_APP_THEME_SUCCESS, diff --git a/app/client/src/sagas/DatasourcesSagas.ts b/app/client/src/sagas/DatasourcesSagas.ts index d7999e29fa..ab004acfe3 100644 --- a/app/client/src/sagas/DatasourcesSagas.ts +++ b/app/client/src/sagas/DatasourcesSagas.ts @@ -174,24 +174,16 @@ import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelector import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag"; import { identifyEntityFromPath } from "../navigation/FocusEntity"; import { MAX_DATASOURCE_SUGGESTIONS } from "constants/DatasourceEditorConstants"; -import { getFromServerWhenNoPrefetchedResult } from "./helper"; function* fetchDatasourcesSaga( - action: ReduxAction< - | { workspaceId?: string; datasources?: ApiResponse } - | undefined - >, + action: ReduxAction<{ workspaceId?: string } | undefined>, ) { try { let workspaceId: string = yield select(getCurrentWorkspaceId); if (action.payload?.workspaceId) workspaceId = action.payload?.workspaceId; - const datasources = action.payload?.datasources; - const response: ApiResponse = yield call( - getFromServerWhenNoPrefetchedResult, - datasources, - async () => DatasourcesApi.fetchDatasources(workspaceId), - ); + const response: ApiResponse = + yield DatasourcesApi.fetchDatasources(workspaceId); const isValidResponse: boolean = yield validateResponse(response); if (isValidResponse) { yield put({ @@ -239,17 +231,9 @@ function* fetchDatasourceStructureOnLoad() { } catch (error) {} } -function* fetchMockDatasourcesSaga(action?: { - payload?: { mockDatasources?: ApiResponse }; -}) { - const mockDatasources = action?.payload?.mockDatasources; +function* fetchMockDatasourcesSaga() { try { - const response: ApiResponse = yield call( - getFromServerWhenNoPrefetchedResult, - mockDatasources, - async () => DatasourcesApi.fetchMockDatasources(), - ); - + const response: ApiResponse = yield DatasourcesApi.fetchMockDatasources(); // not validating the api call here. If the call is unsuccessful it'll be unblocking. And we'll hide the mock DB section. yield put({ type: ReduxActionTypes.FETCH_MOCK_DATASOURCES_SUCCESS, diff --git a/app/client/src/sagas/InitSagas.ts b/app/client/src/sagas/InitSagas.ts index e9706e11a3..1c03654377 100644 --- a/app/client/src/sagas/InitSagas.ts +++ b/app/client/src/sagas/InitSagas.ts @@ -1,4 +1,4 @@ -import { get, identity, pickBy } from "lodash"; +import { get } from "lodash"; import { all, call, @@ -24,7 +24,6 @@ import { resetCurrentApplication } from "@appsmith/actions/applicationActions"; import log from "loglevel"; import * as Sentry from "@sentry/react"; import { resetRecentEntities } from "actions/globalSearchActions"; - import { initAppViewer, initEditor, @@ -40,14 +39,10 @@ import { getIsInitialized as getIsViewerInitialized } from "selectors/appViewSel import { enableGuidedTour } from "actions/onboardingActions"; import { setPreviewModeAction } from "actions/editorActions"; import type { AppEnginePayload } from "entities/Engine"; -import { PageNotFoundError } from "entities/Engine"; import type AppEngine from "entities/Engine"; import { AppEngineApiError } from "entities/Engine"; import AppEngineFactory from "entities/Engine/factory"; -import type { - ApplicationPagePayload, - FetchApplicationResponse, -} from "@appsmith/api/ApplicationApi"; +import type { ApplicationPagePayload } from "@appsmith/api/ApplicationApi"; import { getSearchQuery, updateSlugNamesInURL } from "utils/helpers"; import { generateAutoHeightLayoutTreeAction } from "actions/autoHeightActions"; import { safeCrashAppRequest } from "../actions/errorActions"; @@ -70,28 +65,6 @@ import AnalyticsUtil from "utils/AnalyticsUtil"; import { getAppMode } from "@appsmith/selectors/applicationSelectors"; import { getDebuggerErrors } from "selectors/debuggerSelectors"; import { deleteErrorLog } from "actions/debuggerActions"; -import { getCurrentUser } from "actions/authActions"; - -import { getCurrentTenant } from "@appsmith/actions/tenantActions"; -import { - fetchFeatureFlagsInit, - fetchProductAlertInit, -} from "actions/userActions"; -import { validateResponse } from "./ErrorSagas"; -import type { ApiResponse } from "api/ApiResponses"; -import type { ProductAlert } from "reducers/uiReducers/usersReducer"; -import type { FeatureFlags } from "@appsmith/entities/FeatureFlag"; -import { FEATURE_FLAG } from "@appsmith/entities/FeatureFlag"; -import type { Action, ActionViewMode } from "entities/Action"; -import type { JSCollection } from "entities/JSCollection"; -import type { FetchPageResponse, FetchPageResponseData } from "api/PageApi"; -import type { AppTheme } from "entities/AppTheming"; -import type { Datasource } from "entities/Datasource"; -import type { Plugin, PluginFormPayload } from "api/PluginApi"; -import { selectFeatureFlagCheck } from "@appsmith/selectors/featureFlagsSelectors"; -import { fetchFeatureFlags } from "@appsmith/sagas/userSagas"; -import ConsolidatedPageLoadApi from "api/ConsolidatedPageLoadApi"; -import { axiosConnectionAbortedCode } from "@appsmith/api/ApiUtils"; export const URL_CHANGE_ACTIONS = [ ReduxActionTypes.CURRENT_APPLICATION_NAME_UPDATE, @@ -103,40 +76,7 @@ export interface ReduxURLChangeAction { type: typeof URL_CHANGE_ACTIONS; payload: ApplicationPagePayload | ApplicationPayload | Page; } -export interface DeployConsolidatedApi { - productAlert: ApiResponse; - tenantConfig: ApiResponse; - featureFlags: ApiResponse; - userProfile: ApiResponse; - pages: FetchApplicationResponse; - publishedActions: ApiResponse; - publishedActionCollections: ApiResponse; - customJSLibraries: ApiResponse; - pageWithMigratedDsl: FetchPageResponse; - currentTheme: ApiResponse; - themes: ApiResponse; -} -export interface EditConsolidatedApi { - productAlert: ApiResponse; - tenantConfig: ApiResponse; - featureFlags: ApiResponse; - userProfile: ApiResponse; - pages: FetchApplicationResponse; - publishedActions: ApiResponse; - publishedActionCollections: ApiResponse; - customJSLibraries: ApiResponse; - pageWithMigratedDsl: FetchPageResponse; - currentTheme: ApiResponse; - themes: ApiResponse; - datasources: ApiResponse; - pagesWithMigratedDsl: ApiResponse; - plugins: ApiResponse; - mockDatasources: ApiResponse; - pluginFormConfigs: ApiResponse[]; - unpublishedActions: ApiResponse; - unpublishedActionCollections: ApiResponse; -} -export type InitConsolidatedApi = DeployConsolidatedApi | EditConsolidatedApi; + export function* failFastApiCalls( triggerActions: Array | ReduxActionWithoutPayload>, successActions: string[], @@ -193,114 +133,6 @@ export function* reportSWStatus() { }); } } -function* isConsolidatedFetchFeatureFlagEnabled() { - yield call(fetchFeatureFlags); - - const consolidatedApiFetch: boolean = yield select( - selectFeatureFlagCheck, - FEATURE_FLAG.rollout_consolidated_page_load_fetch_enabled, - ); - return consolidatedApiFetch; -} -function* executeActionDuringUserDetailsInitialisation( - actionType: string, - shouldInitialiseUserDetails?: boolean, -) { - if (!shouldInitialiseUserDetails) { - return; - } - yield put({ type: actionType }); -} - -export function* getInitResponses({ - applicationId, - mode, - pageId, - shouldInitialiseUserDetails, -}: { - applicationId?: string; - pageId?: string; - branch?: string; - mode?: APP_MODE; - shouldInitialiseUserDetails?: boolean; -}): any { - const params = pickBy( - { - applicationId, - defaultPageId: pageId, - mode, - }, - identity, - ); - let response: InitConsolidatedApi | undefined; - - const isConsolidatedApiFetchEnabled = yield call( - isConsolidatedFetchFeatureFlagEnabled, - ); - - if (!!isConsolidatedApiFetchEnabled) { - try { - yield call( - executeActionDuringUserDetailsInitialisation, - ReduxActionTypes.START_CONSOLIDATED_PAGE_LOAD, - shouldInitialiseUserDetails, - ); - - const initConsolidatedApiResponse: ApiResponse = - yield mode === APP_MODE.EDIT - ? ConsolidatedPageLoadApi.getConsolidatedPageLoadDataEdit(params) - : ConsolidatedPageLoadApi.getConsolidatedPageLoadDataView(params); - - const isValidResponse: boolean = yield validateResponse( - initConsolidatedApiResponse, - ); - response = initConsolidatedApiResponse.data; - - if (!isValidResponse) { - // its only invalid when there is a axios related error - throw new Error("Error occured " + axiosConnectionAbortedCode); - } - } catch (e) { - yield call( - executeActionDuringUserDetailsInitialisation, - ReduxActionTypes.END_CONSOLIDATED_PAGE_LOAD, - shouldInitialiseUserDetails, - ); - Sentry.captureMessage( - `consolidated api failure for ${JSON.stringify( - params, - )} errored message response ${e}`, - ); - throw new PageNotFoundError(`Cannot find page with id: ${pageId}`); - } - } - - const { featureFlags, productAlert, tenantConfig, userProfile, ...rest } = - response || {}; - //actions originating from INITIALIZE_CURRENT_PAGE should update user details - //other actions are not necessary - - if (!shouldInitialiseUserDetails) { - return rest; - } - - yield put(getCurrentUser(userProfile)); - // we already fetch this feature flag when isConsolidatedApiFetchEnabled is true - // do not fetch this again - if (isConsolidatedApiFetchEnabled) { - yield put(fetchFeatureFlagsInit(featureFlags)); - } - - yield put(getCurrentTenant(false, tenantConfig)); - - yield put(fetchProductAlertInit(productAlert)); - yield call( - executeActionDuringUserDetailsInitialisation, - ReduxActionTypes.END_CONSOLIDATED_PAGE_LOAD, - shouldInitialiseUserDetails, - ); - return rest; -} export function* startAppEngine(action: ReduxAction) { try { @@ -310,22 +142,12 @@ export function* startAppEngine(action: ReduxAction) { ); engine.startPerformanceTracking(); yield call(engine.setupEngine, action.payload); - const allResponses: InitConsolidatedApi = yield call(getInitResponses, { - ...action.payload, - }); const { applicationId, toLoadPageId } = yield call( engine.loadAppData, action.payload, - allResponses, ); yield call(engine.loadAppURL, toLoadPageId, action.payload.pageId); - - yield call( - engine.loadAppEntities, - toLoadPageId, - applicationId, - allResponses, - ); + yield call(engine.loadAppEntities, toLoadPageId, applicationId); yield call(engine.loadGit, applicationId); yield call(engine.completeChore); yield put(generateAutoHeightLayoutTreeAction(true, false)); @@ -418,55 +240,38 @@ function* appEngineSaga(action: ReduxAction) { function* eagerPageInitSaga() { const url = window.location.pathname; const search = window.location.search; - - if (isEditorPath(url)) { - const matchObj = matchBuilderPath(url); - if (matchObj) { - const { - params: { applicationId, pageId }, - } = matchObj; - const branch = getSearchQuery(search, GIT_BRANCH_QUERY_KEY); - if (pageId) { - yield put( - initEditor({ - pageId, - applicationId, - branch, - mode: APP_MODE.EDIT, - shouldInitialiseUserDetails: true, - }), - ); - return; - } + const matchedUrl = matchBuilderPath(url); + if (isEditorPath(url) && matchedUrl) { + const { + params: { applicationId, pageId }, + } = matchedUrl; + const branch = getSearchQuery(search, GIT_BRANCH_QUERY_KEY); + if (pageId) { + yield put( + initEditor({ + pageId, + applicationId, + branch, + mode: APP_MODE.EDIT, + }), + ); } } else if (isViewerPath(url)) { - const matchObj = matchViewerPath(url); - if (matchObj) { - const { - params: { applicationId, pageId }, - } = matchObj; - const branch = getSearchQuery(search, GIT_BRANCH_QUERY_KEY); - if (applicationId || pageId) { - yield put( - initAppViewer({ - applicationId, - branch, - pageId, - mode: APP_MODE.PUBLISHED, - shouldInitialiseUserDetails: true, - }), - ); - return; - } + const { + params: { applicationId, pageId }, + } = matchViewerPath(url); + const branch = getSearchQuery(search, GIT_BRANCH_QUERY_KEY); + if (applicationId || pageId) { + yield put( + initAppViewer({ + applicationId, + branch, + pageId, + mode: APP_MODE.PUBLISHED, + }), + ); } } - - try { - yield call(getInitResponses, { - shouldInitialiseUserDetails: true, - mode: APP_MODE.PUBLISHED, - }); - } catch (e) {} } export default function* watchInitSagas() { diff --git a/app/client/src/sagas/JSLibrarySaga.ts b/app/client/src/sagas/JSLibrarySaga.ts index 4eb5c3eda7..e2a08b7dca 100644 --- a/app/client/src/sagas/JSLibrarySaga.ts +++ b/app/client/src/sagas/JSLibrarySaga.ts @@ -35,7 +35,6 @@ import AppsmithConsole from "utils/AppsmithConsole"; import { selectInstalledLibraries } from "@appsmith/selectors/entitiesSelector"; import { toast } from "design-system"; import { endSpan, startRootSpan } from "UITelemetry/generateTraces"; -import { getFromServerWhenNoPrefetchedResult } from "./helper"; export function parseErrorMessage(text: string) { return text.split(": ").slice(1).join(""); @@ -310,23 +309,16 @@ function* uninstallLibrarySaga(action: ReduxAction) { } } -function* fetchJSLibraries( - action: ReduxAction<{ - applicationId: string; - customJSLibraries: ApiResponse; - }>, -) { +function* fetchJSLibraries(action: ReduxAction) { const span = startRootSpan("fetchJSLibraries"); - const { applicationId, customJSLibraries } = action.payload; + const applicationId: string = action.payload; const mode: APP_MODE = yield select(getAppMode); - try { const response: ApiResponse = yield call( - getFromServerWhenNoPrefetchedResult, - customJSLibraries, - () => call(LibraryApi.getLibraries, applicationId, mode), + LibraryApi.getLibraries, + applicationId, + mode, ); - const isValidResponse: boolean = yield validateResponse(response); if (!isValidResponse) { endSpan(span); diff --git a/app/client/src/sagas/PluginSagas.ts b/app/client/src/sagas/PluginSagas.ts index 46916f970f..3da9b75769 100644 --- a/app/client/src/sagas/PluginSagas.ts +++ b/app/client/src/sagas/PluginSagas.ts @@ -39,15 +39,11 @@ import type { FormDatasourceButtonConfigs, } from "utils/DynamicBindingUtils"; import type { ActionDataState } from "@appsmith/reducers/entityReducers/actionsReducer"; -import { getFromServerWhenNoPrefetchedResult } from "./helper"; function* fetchPluginsSaga( - action: ReduxAction< - { workspaceId?: string; plugins?: ApiResponse } | undefined - >, + action: ReduxAction<{ workspaceId?: string } | undefined>, ) { try { - const plugins = action.payload?.plugins; let workspaceId: string = yield select(getCurrentWorkspaceId); if (action.payload?.workspaceId) workspaceId = action.payload?.workspaceId; @@ -55,11 +51,9 @@ function* fetchPluginsSaga( throw Error("Workspace id does not exist"); } const pluginsResponse: ApiResponse = yield call( - getFromServerWhenNoPrefetchedResult, - plugins, - () => call(PluginsApi.fetchPlugins, workspaceId), + PluginsApi.fetchPlugins, + workspaceId, ); - const isValid: boolean = yield validateResponse(pluginsResponse); if (isValid) { yield put({ @@ -75,10 +69,7 @@ function* fetchPluginsSaga( } } -function* fetchPluginFormConfigsSaga(action?: { - payload?: { pluginFormConfigs?: ApiResponse }; -}) { - const pluginFormConfigs = action?.payload?.pluginFormConfigs; +function* fetchPluginFormConfigsSaga() { try { const datasources: Datasource[] = yield select(getDatasources); const plugins: Plugin[] = yield select(getPlugins); @@ -105,19 +96,10 @@ function* fetchPluginFormConfigsSaga(action?: { } const pluginFormData: PluginFormPayload[] = []; - const pluginFormResponses: ApiResponse[] = yield call( - getFromServerWhenNoPrefetchedResult, - pluginFormConfigs && - [...pluginIdFormsToFetch].map((id) => ({ - ...pluginFormConfigs, - data: pluginFormConfigs?.data?.[id as any], - })), - () => - all( - [...pluginIdFormsToFetch].map((id) => - call(PluginsApi.fetchFormConfig, id), - ), - ), + const pluginFormResponses: ApiResponse[] = yield all( + [...pluginIdFormsToFetch].map((id) => + call(PluginsApi.fetchFormConfig, id), + ), ); for (let i = 0; i < pluginFormResponses.length; i++) { diff --git a/app/client/src/sagas/__tests__/initSagas.test.ts b/app/client/src/sagas/__tests__/initSagas.test.ts index aaee4d5074..5187b96e03 100644 --- a/app/client/src/sagas/__tests__/initSagas.test.ts +++ b/app/client/src/sagas/__tests__/initSagas.test.ts @@ -3,7 +3,6 @@ import { APP_MODE } from "entities/App"; import type AppEngine from "entities/Engine"; import AppEngineFactory from "entities/Engine/factory"; import { call } from "redux-saga/effects"; -import { getInitResponses } from "sagas/InitSagas"; import { startAppEngine } from "sagas/InitSagas"; jest.mock("../../api/Api", () => ({ @@ -22,7 +21,6 @@ describe("tests the sagas in initSagas", () => { }, }; const gen = startAppEngine(action); - const engine: AppEngine = AppEngineFactory.create( APP_MODE.EDIT, APP_MODE.EDIT, @@ -30,24 +28,15 @@ describe("tests the sagas in initSagas", () => { expect(JSON.stringify(gen.next().value)).toStrictEqual( JSON.stringify(call(engine.setupEngine, action.payload)), ); - expect(gen.next().value).toStrictEqual( - call(getInitResponses, action.payload), - ); - const someInitResponse = { - pages: { responseMeta: {}, data: {}, code: "232" }, - } as any; - - expect(JSON.stringify(gen.next(someInitResponse).value)).toStrictEqual( - JSON.stringify( - call(engine.loadAppData, action.payload, someInitResponse), - ), + expect(JSON.stringify(gen.next().value)).toStrictEqual( + JSON.stringify(call(engine.loadAppData, action.payload)), ); expect( JSON.stringify( gen.next({ applicationId: action.payload.applicationId, toLoadPageId: action.payload.pageId, - } as any).value, + }).value, ), ).toStrictEqual( JSON.stringify( @@ -60,7 +49,6 @@ describe("tests the sagas in initSagas", () => { engine.loadAppEntities, action.payload.pageId, action.payload.applicationId, - someInitResponse, ), ), ); diff --git a/app/client/src/sagas/helper.ts b/app/client/src/sagas/helper.ts index d025e9a1a8..01eef2599e 100644 --- a/app/client/src/sagas/helper.ts +++ b/app/client/src/sagas/helper.ts @@ -25,7 +25,6 @@ import log from "loglevel"; import { isPlainObject, isString } from "lodash"; import { DATA_BIND_REGEX_GLOBAL } from "constants/BindingsConstants"; import { klona } from "klona/lite"; -import { apiFailureResponseInterceptor } from "@appsmith/api/ApiUtils"; // function to extract all objects that have dynamic values export const extractFetchDynamicValueFormConfigs = ( @@ -204,29 +203,3 @@ export async function generateHashFromString(str: unknown) { return hashHex; } - -export function* getFromServerWhenNoPrefetchedResult( - prefetchedResult?: any, - apiEffect?: any, -): any { - if (prefetchedResult) { - if (prefetchedResult?.responseMeta?.error) { - const { responseMeta } = prefetchedResult; - const { status } = responseMeta; - - const resp = yield apiFailureResponseInterceptor({ - response: { - data: { - responseMeta, - }, - status, - }, - }); - return resp; - } - - return prefetchedResult; - } - - return yield apiEffect(); -} diff --git a/app/client/src/selectors/ui.tsx b/app/client/src/selectors/ui.tsx index 435410addc..2c250c55a5 100644 --- a/app/client/src/selectors/ui.tsx +++ b/app/client/src/selectors/ui.tsx @@ -65,6 +65,3 @@ export const getDatasourceCollapsibleState = createSelector( export const getIsImportingCurl = (state: AppState) => state.ui.imports.isImportingCurl; - -export const getIsConsolidatedPageLoading = (state: AppState) => - state.ui.consolidatedPageLoad.isLoading;