PromucFlow_constructor/app/client/test/testCommon.ts

283 lines
6.9 KiB
TypeScript
Raw Normal View History

import { ReduxActionTypes } from "ee/constants/ReduxActionConstants";
import { initEditorAction } from "actions/initActions";
import { setAppMode, updateCurrentPage } from "actions/pageActions";
import { APP_MODE } from "entities/App";
import { useDispatch } from "react-redux";
import type { CanvasWidgetsReduxState } from "ee/reducers/entityReducers/canvasWidgetsReducer";
import { getCanvasWidgetsPayload } from "ee/sagas/PageSagas";
import { editorInitializer } from "utils/editor/EditorUtils";
import { extractCurrentDSL } from "utils/WidgetPropsUtils";
import type { AppState } from "ee/reducers";
import type { WidgetEntity } from "ee/entities/DataTree/types";
import urlBuilder from "ee/entities/URLRedirect/URLAssembly";
import type { FlattenedWidgetProps } from "ee/reducers/entityReducers/canvasWidgetsStructureReducer";
chore: Cleanup Redux Actions file (#35720) ## Description Cleans out and reorganises the Redux Actions Constants file Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/10489649733> > Commit: 9fa7003f7c2d1b43a6c693cb1d34ba5cc2c11832 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10489649733&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Wed, 21 Aug 2024 13:45:56 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced new interfaces for enhanced structured data handling related to page management and property pane visibility. - Added functionality to control widget panel visibility with a new action. - **Bug Fixes** - Improved flexibility in closing property panes by adding an optional parameter to the related function. - **Refactor** - Streamlined import statements for various types to improve organization and maintainability. - Removed unused functions and action handlers to simplify user and data source management. - Updated action type constants for consistency across the application. - Removed sagas related to URL redirection and history management, simplifying navigation handling. - **Chores** - Cleaned up unused imports to reduce code clutter and improve readability. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-08-22 04:19:30 +00:00
import type { Page } from "entities/Page";
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
import { useEffect, useState } from "react";
import type { FetchPageResponse } from "api/PageApi";
chore: Unify ID extraction regex from browser url (#33925) ## Description Regex update to make it compatible to extract identifiers for both Mongo ObjectIds and UUIDs. This will help us to keep the unified logic required in `pg` branch. ## Automation /ok-to-test tags="@tag.Datasource, @tag.GenerateCRUD, @tag.ImportExport, @tag.Fork, @tag.Workspace, @tag.Sanity" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9405554200> > Commit: 3959703aab1d10e28d3b80057793476467126929 > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9405554200&attempt=2" target="_blank">Click here!</a> <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced URL path handling to support both UUID and Mongo ObjectIds. - **Refactor** - Replaced hardcoded page IDs with dynamic variables across multiple test files for improved maintainability and flexibility. - **Tests** - Updated test cases to use dynamic page IDs, ensuring consistency and easier updates in the future. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-06-11 09:44:54 +00:00
const pageId = "0123456789abcdef00000000";
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
export const useMockDsl = (dsl: unknown, mode?: APP_MODE) => {
const dispatch = useDispatch();
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
const [hasLoaded, setHasLoaded] = useState(false);
const mockResp = {
data: {
chore: Unify ID extraction regex from browser url (#33925) ## Description Regex update to make it compatible to extract identifiers for both Mongo ObjectIds and UUIDs. This will help us to keep the unified logic required in `pg` branch. ## Automation /ok-to-test tags="@tag.Datasource, @tag.GenerateCRUD, @tag.ImportExport, @tag.Fork, @tag.Workspace, @tag.Sanity" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9405554200> > Commit: 3959703aab1d10e28d3b80057793476467126929 > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9405554200&attempt=2" target="_blank">Click here!</a> <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced URL path handling to support both UUID and Mongo ObjectIds. - **Refactor** - Replaced hardcoded page IDs with dynamic variables across multiple test files for improved maintainability and flexibility. - **Tests** - Updated test cases to use dynamic page IDs, ensuring consistency and easier updates in the future. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-06-11 09:44:54 +00:00
id: pageId,
pageId: pageId,
name: "Page1",
applicationId: "app_id",
isDefault: true,
isHidden: false,
slug: "page-1",
layouts: [
{
id: "layout_id",
dsl,
layoutOnLoadActions: [],
layoutActions: [],
},
],
userPermissions: [
"read:pages",
"manage:pages",
"create:pageActions",
"delete:pages",
],
},
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
} as unknown as FetchPageResponse;
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
useEffect(function loadScripts() {
const loadMigrationScripts = async () => {
const canvasWidgetsPayloadD = await getCanvasWidgetsPayload(mockResp);
const currentDSL = await extractCurrentDSL({
response: mockResp,
});
const currentDsl = currentDSL.dsl;
const canvasWidgetsPayload = canvasWidgetsPayloadD.widgets;
dispatch(setAppMode(mode || APP_MODE.EDIT));
dispatch({
type: ReduxActionTypes.FETCH_PAGE_DSLS_SUCCESS,
payload: [
{
pageId: mockResp.data.id,
dsl: currentDsl,
},
],
});
const pages = [
{
pageName: mockResp.data.name,
pageId: mockResp.data.id,
basePageId: mockResp.data.id,
isDefault: mockResp.data.isDefault,
isHidden: !!mockResp.data.isHidden,
slug: mockResp.data.slug,
userPermissions: [
"read:pages",
"manage:pages",
"create:pageActions",
"delete:pages",
],
},
] as unknown as Page[];
dispatch({
type: ReduxActionTypes.FETCH_PAGE_LIST_SUCCESS,
payload: {
pages,
applicationId: mockResp.data.applicationId,
},
});
dispatch({
type: "UPDATE_LAYOUT",
payload: { widgets: canvasWidgetsPayload },
});
dispatch(updateCurrentPage(mockResp.data.id));
setHasLoaded(true);
};
loadMigrationScripts();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
return hasLoaded;
};
refactor: Widget Selection (#19643) ## Description This change is a refactor of widget selection logic. It consolidates all the business logic to make it easy to maintain. It also improves the performance a bit. It touched a lot of features as we heavily rely on this ``` Select one Select multiple with drag Select multiple with shift Select multiple with cmd/ctrl Selections should be on the same level of hierarchy Unselect all by clicking on the canvas Unselect all by pressing esc Select all with cmd + a Paste in main container Paste in another container Undo Redo Modal Selection Modal child selection Context switching cmd click snipping mode new widget suggestion onboarding ``` > Refactor widget selection logic Fixes #19570 ## Type of change - Refactor ## How Has This Been Tested? All existing tests should pass ### Test Plan > Add Testsmith test cases links that relate to this PR ### Issues raised during DP testing https://github.com/appsmithorg/appsmith/pull/19643#issuecomment-1383570810 https://github.com/appsmithorg/appsmith/pull/19643#issuecomment-1383607820 https://github.com/appsmithorg/appsmith/pull/19643#issuecomment-1385095478 [Bug bash issues](https://www.notion.so/appsmith/610aa302f3e146a7b090b7dc6bc63ef9?v=0d277a9b07bf4aac9d717bcaf138c33a) ## 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: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test
2023-01-28 02:17:06 +00:00
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
export function MockPageDSL({
children,
dsl,
}: {
children: JSX.Element;
dsl?: unknown;
}) {
editorInitializer();
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
const hasLoaded = useMockDsl(dsl);
return hasLoaded ? children : null;
}
perf: Widget re-rendering refactor (#14485) * initial commit * props hoc * changes * removed ignores and withWidgetProps * added extra props to canvasStructure * widget props changes * list widget changes * reintroduced widget props hook and other refactors * remove warnings * added deepequal for childWidgets selector * fix global hotkeys and tabs widget jest test * fix main container test fix * fixed view mode width * fix form widget values * minor fix * fix skeleton * form widget validity fix * jest test fix * fixed tests: GlobalHotkeys, Tabs, CanvasSelectectionArena and fixed main container rendering * minor fix * minor comments * reverted commented code * simplified structure, selective redux state updates and other inconsistencies * fix junit test cases * stop form widget from force rendering children * fix test case * random commit to re run tests * update isFormValid prop only if it exists * detangling circular dependency * fixing cypress tests * cleaned up code * clean up man cnavas props and fix jest cases * fix rendering order of child widgets for canvas * fix dropdown reset spec * adding comments * cleaning up unwanted code * fix multiselect widget on deploy * adressing review comments * addressing minor review comment changes * destructuring modal widget child and fix test case * fix communityIssues cypress spec * rewrite isVisible logic to match previous behaviour * merging widget props with component props before checking isVisible * adressing review comments for modal widget's isVisible Co-authored-by: rahulramesha <rahul@appsmith.com>
2022-08-19 10:10:36 +00:00
const getChildWidgets = (
canvasWidgets: CanvasWidgetsReduxState,
widgetId: string,
) => {
const parentWidget = canvasWidgets[widgetId];
if (parentWidget.children) {
return parentWidget.children.map((childWidgetId) => {
fix: Improving performance of JS evaluations by splitting the data tree (#21547) ## Description This is the second phase of the split data tree. In the previous version, we collected all config paths in each entity and put them in the `__config__` property. All those config properties do get inserted into final data tree which we don't need at all. As part of this change, we will be creating another tree i.e **'configTree'** which will contain all config of each entity. unEvalTree is split into 2 trees => 1. unEvalTree 2. configTree Example: previous unEvalTree Api1 content <img width="1766" alt="image" src="https://user-images.githubusercontent.com/7846888/215990868-0b095421-e7b8-44bc-89aa-065b35e237d6.png"> After this change unEvalTree Api1 content <img width="1758" alt="image" src="https://user-images.githubusercontent.com/7846888/215991045-506fb10a-645a-4aad-8e77-0f3786a86977.png"> Note- above example doesn't have '__config__' property configTree Api1 content <img width="1760" alt="image" src="https://user-images.githubusercontent.com/7846888/215991169-a2e03443-5d6a-4ff1-97c5-a12593e46395.png"> ## Type of change - Chore (housekeeping or task changes that don't impact user perception) - #11351 ## How Has This Been Tested? - Manual - Jest - 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: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-03-20 11:04:02 +00:00
const childWidget = { ...canvasWidgets[childWidgetId] } as WidgetEntity;
perf: Widget re-rendering refactor (#14485) * initial commit * props hoc * changes * removed ignores and withWidgetProps * added extra props to canvasStructure * widget props changes * list widget changes * reintroduced widget props hook and other refactors * remove warnings * added deepequal for childWidgets selector * fix global hotkeys and tabs widget jest test * fix main container test fix * fixed view mode width * fix form widget values * minor fix * fix skeleton * form widget validity fix * jest test fix * fixed tests: GlobalHotkeys, Tabs, CanvasSelectectionArena and fixed main container rendering * minor fix * minor comments * reverted commented code * simplified structure, selective redux state updates and other inconsistencies * fix junit test cases * stop form widget from force rendering children * fix test case * random commit to re run tests * update isFormValid prop only if it exists * detangling circular dependency * fixing cypress tests * cleaned up code * clean up man cnavas props and fix jest cases * fix rendering order of child widgets for canvas * fix dropdown reset spec * adding comments * cleaning up unwanted code * fix multiselect widget on deploy * adressing review comments * addressing minor review comment changes * destructuring modal widget child and fix test case * fix communityIssues cypress spec * rewrite isVisible logic to match previous behaviour * merging widget props with component props before checking isVisible * adressing review comments for modal widget's isVisible Co-authored-by: rahulramesha <rahul@appsmith.com>
2022-08-19 10:10:36 +00:00
if (childWidget?.children?.length > 0) {
childWidget.children = getChildWidgets(canvasWidgets, childWidgetId);
}
return childWidget;
});
}
return [];
};
export const mockGetChildWidgets = (state: AppState, widgetId: string) => {
return getChildWidgets(state.entities.canvasWidgets, widgetId);
};
export const mockGetPagePermissions = () => {
return ["read:pages", "manage:pages", "create:pageActions", "delete:pages"];
};
perf: Widget re-rendering refactor (#14485) * initial commit * props hoc * changes * removed ignores and withWidgetProps * added extra props to canvasStructure * widget props changes * list widget changes * reintroduced widget props hook and other refactors * remove warnings * added deepequal for childWidgets selector * fix global hotkeys and tabs widget jest test * fix main container test fix * fixed view mode width * fix form widget values * minor fix * fix skeleton * form widget validity fix * jest test fix * fixed tests: GlobalHotkeys, Tabs, CanvasSelectectionArena and fixed main container rendering * minor fix * minor comments * reverted commented code * simplified structure, selective redux state updates and other inconsistencies * fix junit test cases * stop form widget from force rendering children * fix test case * random commit to re run tests * update isFormValid prop only if it exists * detangling circular dependency * fixing cypress tests * cleaned up code * clean up man cnavas props and fix jest cases * fix rendering order of child widgets for canvas * fix dropdown reset spec * adding comments * cleaning up unwanted code * fix multiselect widget on deploy * adressing review comments * addressing minor review comment changes * destructuring modal widget child and fix test case * fix communityIssues cypress spec * rewrite isVisible logic to match previous behaviour * merging widget props with component props before checking isVisible * adressing review comments for modal widget's isVisible Co-authored-by: rahulramesha <rahul@appsmith.com>
2022-08-19 10:10:36 +00:00
export const mockCreateCanvasWidget = (
canvasWidget: FlattenedWidgetProps,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
fix: Improving performance of JS evaluations by splitting the data tree (#21547) ## Description This is the second phase of the split data tree. In the previous version, we collected all config paths in each entity and put them in the `__config__` property. All those config properties do get inserted into final data tree which we don't need at all. As part of this change, we will be creating another tree i.e **'configTree'** which will contain all config of each entity. unEvalTree is split into 2 trees => 1. unEvalTree 2. configTree Example: previous unEvalTree Api1 content <img width="1766" alt="image" src="https://user-images.githubusercontent.com/7846888/215990868-0b095421-e7b8-44bc-89aa-065b35e237d6.png"> After this change unEvalTree Api1 content <img width="1758" alt="image" src="https://user-images.githubusercontent.com/7846888/215991045-506fb10a-645a-4aad-8e77-0f3786a86977.png"> Note- above example doesn't have '__config__' property configTree Api1 content <img width="1760" alt="image" src="https://user-images.githubusercontent.com/7846888/215991169-a2e03443-5d6a-4ff1-97c5-a12593e46395.png"> ## Type of change - Chore (housekeeping or task changes that don't impact user perception) - #11351 ## How Has This Been Tested? - Manual - Jest - 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: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-03-20 11:04:02 +00:00
evaluatedWidget: WidgetEntity,
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
) => {
perf: Widget re-rendering refactor (#14485) * initial commit * props hoc * changes * removed ignores and withWidgetProps * added extra props to canvasStructure * widget props changes * list widget changes * reintroduced widget props hook and other refactors * remove warnings * added deepequal for childWidgets selector * fix global hotkeys and tabs widget jest test * fix main container test fix * fixed view mode width * fix form widget values * minor fix * fix skeleton * form widget validity fix * jest test fix * fixed tests: GlobalHotkeys, Tabs, CanvasSelectectionArena and fixed main container rendering * minor fix * minor comments * reverted commented code * simplified structure, selective redux state updates and other inconsistencies * fix junit test cases * stop form widget from force rendering children * fix test case * random commit to re run tests * update isFormValid prop only if it exists * detangling circular dependency * fixing cypress tests * cleaned up code * clean up man cnavas props and fix jest cases * fix rendering order of child widgets for canvas * fix dropdown reset spec * adding comments * cleaning up unwanted code * fix multiselect widget on deploy * adressing review comments * addressing minor review comment changes * destructuring modal widget child and fix test case * fix communityIssues cypress spec * rewrite isVisible logic to match previous behaviour * merging widget props with component props before checking isVisible * adressing review comments for modal widget's isVisible Co-authored-by: rahulramesha <rahul@appsmith.com>
2022-08-19 10:10:36 +00:00
return { ...canvasWidget };
};
export const mockGetWidgetEvalValues = (
state: AppState,
widgetName: string,
) => {
return Object.values(state.entities.canvasWidgets).find(
(widget) => widget.widgetName === widgetName,
fix: Improving performance of JS evaluations by splitting the data tree (#21547) ## Description This is the second phase of the split data tree. In the previous version, we collected all config paths in each entity and put them in the `__config__` property. All those config properties do get inserted into final data tree which we don't need at all. As part of this change, we will be creating another tree i.e **'configTree'** which will contain all config of each entity. unEvalTree is split into 2 trees => 1. unEvalTree 2. configTree Example: previous unEvalTree Api1 content <img width="1766" alt="image" src="https://user-images.githubusercontent.com/7846888/215990868-0b095421-e7b8-44bc-89aa-065b35e237d6.png"> After this change unEvalTree Api1 content <img width="1758" alt="image" src="https://user-images.githubusercontent.com/7846888/215991045-506fb10a-645a-4aad-8e77-0f3786a86977.png"> Note- above example doesn't have '__config__' property configTree Api1 content <img width="1760" alt="image" src="https://user-images.githubusercontent.com/7846888/215991169-a2e03443-5d6a-4ff1-97c5-a12593e46395.png"> ## Type of change - Chore (housekeeping or task changes that don't impact user perception) - #11351 ## How Has This Been Tested? - Manual - Jest - 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: - [ ] Test plan has been approved by relevant developers - [ ] Test plan has been peer reviewed by QA - [ ] Cypress test cases have been added and approved by either SDET or manual QA - [ ] Organized project review call with relevant stakeholders after Round 1/2 of QA - [ ] Added Test Plan Approved label after reveiwing all Cypress test Co-authored-by: Aishwarya UR <aishwarya@appsmith.com>
2023-03-20 11:04:02 +00:00
) as WidgetEntity;
perf: Widget re-rendering refactor (#14485) * initial commit * props hoc * changes * removed ignores and withWidgetProps * added extra props to canvasStructure * widget props changes * list widget changes * reintroduced widget props hook and other refactors * remove warnings * added deepequal for childWidgets selector * fix global hotkeys and tabs widget jest test * fix main container test fix * fixed view mode width * fix form widget values * minor fix * fix skeleton * form widget validity fix * jest test fix * fixed tests: GlobalHotkeys, Tabs, CanvasSelectectionArena and fixed main container rendering * minor fix * minor comments * reverted commented code * simplified structure, selective redux state updates and other inconsistencies * fix junit test cases * stop form widget from force rendering children * fix test case * random commit to re run tests * update isFormValid prop only if it exists * detangling circular dependency * fixing cypress tests * cleaned up code * clean up man cnavas props and fix jest cases * fix rendering order of child widgets for canvas * fix dropdown reset spec * adding comments * cleaning up unwanted code * fix multiselect widget on deploy * adressing review comments * addressing minor review comment changes * destructuring modal widget child and fix test case * fix communityIssues cypress spec * rewrite isVisible logic to match previous behaviour * merging widget props with component props before checking isVisible * adressing review comments for modal widget's isVisible Co-authored-by: rahulramesha <rahul@appsmith.com>
2022-08-19 10:10:36 +00:00
};
export const syntheticTestMouseEvent = (
event: MouseEvent,
optionsToAdd = {},
) => {
const options = Object.entries(optionsToAdd);
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
options.forEach(([key, value]) => {
Object.defineProperty(event, key, { get: () => value });
});
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
return event;
};
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
export function MockApplication({ children }: { children: JSX.Element }) {
editorInitializer();
const dispatch = useDispatch();
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
dispatch(initEditorAction({ basePageId: pageId, mode: APP_MODE.EDIT }));
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
const mockResp = {
workspaceId: "workspace_id",
pages: [
{
chore: Unify ID extraction regex from browser url (#33925) ## Description Regex update to make it compatible to extract identifiers for both Mongo ObjectIds and UUIDs. This will help us to keep the unified logic required in `pg` branch. ## Automation /ok-to-test tags="@tag.Datasource, @tag.GenerateCRUD, @tag.ImportExport, @tag.Fork, @tag.Workspace, @tag.Sanity" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9405554200> > Commit: 3959703aab1d10e28d3b80057793476467126929 > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9405554200&attempt=2" target="_blank">Click here!</a> <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced URL path handling to support both UUID and Mongo ObjectIds. - **Refactor** - Replaced hardcoded page IDs with dynamic variables across multiple test files for improved maintainability and flexibility. - **Tests** - Updated test cases to use dynamic page IDs, ensuring consistency and easier updates in the future. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-06-11 09:44:54 +00:00
id: pageId,
baseId: pageId,
chore: Unify ID extraction regex from browser url (#33925) ## Description Regex update to make it compatible to extract identifiers for both Mongo ObjectIds and UUIDs. This will help us to keep the unified logic required in `pg` branch. ## Automation /ok-to-test tags="@tag.Datasource, @tag.GenerateCRUD, @tag.ImportExport, @tag.Fork, @tag.Workspace, @tag.Sanity" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9405554200> > Commit: 3959703aab1d10e28d3b80057793476467126929 > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9405554200&attempt=2" target="_blank">Click here!</a> <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced URL path handling to support both UUID and Mongo ObjectIds. - **Refactor** - Replaced hardcoded page IDs with dynamic variables across multiple test files for improved maintainability and flexibility. - **Tests** - Updated test cases to use dynamic page IDs, ensuring consistency and easier updates in the future. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-06-11 09:44:54 +00:00
pageId: pageId,
name: "Page1",
isDefault: true,
slug: "page-1",
userPermissions: [
"read:pages",
"manage:pages",
"create:pageActions",
"delete:pages",
],
},
],
id: "app_id",
baseId: "app_id",
isDefault: true,
name: "appName",
slug: "app-name",
applicationVersion: 2,
};
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
urlBuilder.updateURLParams(
{
baseApplicationId: mockResp.baseId,
applicationSlug: mockResp.slug,
applicationVersion: mockResp.applicationVersion,
},
[
{
basePageId: mockResp.pages[0].baseId,
pageSlug: mockResp.pages[0].slug,
},
],
);
dispatch({
type: ReduxActionTypes.FETCH_APPLICATION_SUCCESS,
payload: mockResp,
});
dispatch({
type: ReduxActionTypes.FETCH_PAGE_LIST_SUCCESS,
payload: {
pages: mockResp.pages,
},
});
dispatch({
type: ReduxActionTypes.SWITCH_CURRENT_PAGE_ID,
payload: {
chore: Unify ID extraction regex from browser url (#33925) ## Description Regex update to make it compatible to extract identifiers for both Mongo ObjectIds and UUIDs. This will help us to keep the unified logic required in `pg` branch. ## Automation /ok-to-test tags="@tag.Datasource, @tag.GenerateCRUD, @tag.ImportExport, @tag.Fork, @tag.Workspace, @tag.Sanity" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9405554200> > Commit: 3959703aab1d10e28d3b80057793476467126929 > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9405554200&attempt=2" target="_blank">Click here!</a> <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [x] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Enhanced URL path handling to support both UUID and Mongo ObjectIds. - **Refactor** - Replaced hardcoded page IDs with dynamic variables across multiple test files for improved maintainability and flexibility. - **Tests** - Updated test cases to use dynamic page IDs, ensuring consistency and easier updates in the future. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-06-11 09:44:54 +00:00
id: pageId,
slug: "page-1",
permissions: [
"read:pages",
"manage:pages",
"create:pageActions",
"delete:pages",
],
},
});
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
return children;
}
//got it from @blueprintjs/test-commons to dispatch hotkeys events
export function dispatchTestKeyboardEventWithCode(
target: EventTarget,
eventType: string,
key: string,
keyCode: number,
shift = false,
meta = false,
) {
const event = document.createEvent("KeyboardEvent");
chore: decouple widget-config.json from main chunk (#36924) ## Description We decoupled the widget-config.json file (177KB when zipped) from the main bundle and implemented lazy loading during DSL migrations. This optimisation reduces the size of the main chunk by 10%, which should lead to better performance, specifically improving FCP and LCP, as the main chunk's fetch and evaluation times are reduced Fixes #`Issue Number` _or_ Fixes `Issue URL` > [!WARNING] > _If no issue exists, please create an issue first, and check with the maintainers if the issue is valid._ ## Automation /ok-to-test tags="@tag.All" ### :mag: Cypress test results <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/11384816747> > Commit: ae14b3f40c4c1ef77250157e56aed97acae5cbaf > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11384816747&attempt=2" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Thu, 17 Oct 2024 15:04:34 UTC <!-- end of auto-generated comment: Cypress test results --> ## Communication Should the DevRel and Marketing teams inform users about this change? - [ ] Yes - [ ] No <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit - **New Features** - Enhanced migration logic for DSL widgets with asynchronous operations. - Improved performance with lazy loading of widget configurations. - Added optional properties to page response data structures. - **Bug Fixes** - Resolved issues with dynamic binding path migrations. - **Tests** - Updated test cases to handle asynchronous operations for better reliability and accuracy. - **Chores** - Improved type safety and error handling in widget factory utilities and mock functions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-10-17 15:18:39 +00:00
event.initKeyboardEvent(
eventType,
true,
true,
window,
key,
0,
meta,
false,
shift,
);
Object.defineProperty(event, "key", { get: () => key });
Object.defineProperty(event, "which", { get: () => keyCode });
target.dispatchEvent(event);
}