-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: starter building blocks on canvas removes existing queries and JS objects #32629
fix: starter building blocks on canvas removes existing queries and JS objects #32629
Conversation
WalkthroughThe code changes aim to streamline the integration and management of building blocks within applications. Key updates include introducing new actions and selectors for handling building blocks, refining component behaviors for consistency, and adding functionalities for importing and managing building blocks efficiently. These changes are designed to enhance user interactions and optimize backend processes related to building blocks. Changes
Assessment against linked issues
Possibly related issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/build-deploy-preview skip-tests=true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
const buildingBlockDsl = JSON.parse(response.data.widgetDsl); | ||
const buildingBlockWidgets = buildingBlockDsl.children; | ||
const flattenedBlockWidgets = buildingBlockWidgets.map( | ||
(widget: WidgetProps) => flattenDSL(widget), | ||
); | ||
|
||
// 3. Rename the template page to clicked from page | ||
yield fork(renameStarterTemplatePageToDefault, templatePageIds[0]); | ||
const widgetsToPasteInCanvas: CopiedWidgetData[] = yield all( | ||
flattenedBlockWidgets.map( | ||
(widget: FlattenedWidgetProps, index: number) => { | ||
let widgetPositionInfo: WidgetLayoutPositionInfo | null = null; | ||
if ( | ||
widget.parentId && | ||
layoutSystemType === LayoutSystemTypes.ANVIL | ||
) { | ||
widgetPositionInfo = getWidgetLayoutMetaInfo( | ||
allWidgets[widget?.parentId]?.layout[0] ?? null, | ||
widget.widgetId, | ||
); | ||
} | ||
return { | ||
hierarchy: getWidgetHierarchy( | ||
buildingBlockWidgets[index].type, | ||
buildingBlockWidgets[index].widgetId, | ||
), | ||
list: Object.values(widget) | ||
.map((obj) => ({ ...obj })) | ||
.reverse(), | ||
parentId: MAIN_CONTAINER_WIDGET_ID, | ||
widgetId: buildingBlockWidgets[index].widgetId, | ||
widgetPositionInfo, | ||
}; | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optimize the mapping and processing of widgets in apiCallForForkBuildingBlockToApplication
. The current implementation involves multiple mappings and transformations which could be simplified or optimized to improve performance, especially if the number of widgets is large.
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8659174296. |
Deploy-Preview-URL: https://ce-32629.dp.appsmith.com |
…o bugfix/32573-bb-on-canvas-removes-existing-queries-jsobjects
…o bugfix/32573-bb-on-canvas-removes-existing-queries-jsobjects
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8700412765. |
Deploy-Preview-URL: https://ce-32629.dp.appsmith.com |
This reverts commit a4d9767.
…o bugfix/32573-bb-on-canvas-removes-existing-queries-jsobjects
…o bugfix/32573-bb-on-canvas-removes-existing-queries-jsobjects
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8782172485. |
Deploy-Preview-URL: https://ce-32629.dp.appsmith.com |
…o bugfix/32573-bb-on-canvas-removes-existing-queries-jsobjects
/ci-test-limit runId=8782108653 |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/8796659667. |
/ci-test-limit |
1 similar comment
/ci-test-limit |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/8796862131. |
Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/8796862702. |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/8796862131. |
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/8796862702. |
This reverts commit eb2d5e1.
Description
Root cause:
The original intention of the building blocks on canvas was to serve a new user on their very first app.
Looking at (good) usage of this feature, we turned it on for all pages on all apps.
Now, an experienced user don't always start with UI and thats when we hit this issue.
Additionally, this was a tech debt we had to repay and this PR takes that opportunity to get rid of hack of using
add a page from template
for this feature and uses proper PIE based API to support his.Fixes #32573
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.Templates"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/8797225643
Commit: 5f7f0fd
Cypress dashboard url: Click here!
Summary by CodeRabbit
New Features
Refactor
Bug Fixes
Tests