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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: render only the currently open detached widgets. #33040
Conversation
WalkthroughWalkthroughThe update involves significant changes to enhance the management and rendering of detached widgets in the Anvil layout system. These changes aim to streamline the process, introduce new components for handling detached widgets, and update selectors to support the revamped functionality. Changes
Possibly related issues
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (10)
Files skipped from review as they are similar to previous changes (1)
Additional comments not posted (9)
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 (
|
/build-deploy-preview skip-tests=true |
Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/8880069578. |
Deploy-Preview-URL: https://ce-33040.dp.appsmith.com |
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
export function* callSagaOnlyForAnvil(saga: any, action: ReduxAction<unknown>) { | ||
const isAnvilLayout: boolean = yield select(getIsAnvilLayout); | ||
if (isAnvilLayout) { | ||
yield call(saga, action); | ||
} | ||
} |
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.
Consider adding a type definition for the saga
parameter to enhance type safety and maintainability.
- export function* callSagaOnlyForAnvil(saga: any, action: ReduxAction<unknown>) {
+ export function* callSagaOnlyForAnvil(saga: GeneratorFunction, action: ReduxAction<unknown>) {
Committable suggestion
鈥硷笍 IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
export function* callSagaOnlyForAnvil(saga: any, action: ReduxAction<unknown>) { | |
const isAnvilLayout: boolean = yield select(getIsAnvilLayout); | |
if (isAnvilLayout) { | |
yield call(saga, action); | |
} | |
} | |
export function* callSagaOnlyForAnvil(saga: GeneratorFunction, action: ReduxAction<unknown>) { | |
const isAnvilLayout: boolean = yield select(getIsAnvilLayout); | |
if (isAnvilLayout) { | |
yield call(saga, action); | |
} | |
} |
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.
takeLeading is having type issues if I try this.
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.
@marks0351, it seems like the type GeneratorFunction
might not be directly compatible with what takeLeading
expects for its saga parameter. To resolve the type issues, I recommend checking the type definition of takeLeading
in your project's version of redux-saga. This will help you identify a compatible type for the saga parameter.
If you can provide the specific error message or a snippet of how you're using takeLeading
with callSagaOnlyForAnvil
, I can offer more targeted advice. Alternatively, you might consider using a type assertion if you're confident about the types being handled, or adjusting the type to something more specific that matches the expected input for takeLeading
.
@marks0351 This PR a little hard to review. There are a few things, the rationale behind which I donot understand. I have a few questions, but before that would you mind elaborating on what we've changed and why we've done so, in the PR description, or in a related issue? |
My bad, have updated the PR description, let me know if that helps. |
This reverts commit 16fce05.
[![workerB](https://img.shields.io/endpoint?url=https%3A%2F%2Fworkerb.linearb.io%2Fv2%2Fbadge%2Fprivate%2FU2FsdGVkX1p4H4db8lSv1xTwGoYFAZnRwWdBNC5Y%2Fcollaboration.svg%3FcacheSeconds%3D60)](https://workerb.linearb.io/v2/badge/collaboration-page?magicLinkId=MA2NqRe) ## Description > [!TIP] > _Add a TL;DR when the description is longer than 500 words or extremely technical (helps the content, marketing, and DevRel team)._ > > _Please also include relevant motivation and context. List any dependencies that are required for this change. Add links to Notion, Figma or any other documents that might be relevant to the PR._ In #33040 we added a state exclusively to capture modals that are opened/closed to avoid computing which modal is open based on meta state. However the problem with this approach that I had understood after testing it with deployed apps is that closing a modal is not done only via the saga, but is done via actions and the modal itself without dispatching the common saga. Obviously the above implementation dunked. Reverting to the previous implementation of relying on meta state to select visible detached widgets. 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.Anvil" ### 馃攳 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/8895170744> > Commit: 517ffc6 > Cypress dashboard url: <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8895170744&attempt=1" 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 - [ ] No
Description
Currently we render all the detached widgets(Modal) via a hook and the widget shows up when the metaValue for visibility is toggled for a modal.
Problems with this:
To solve this we are going to rely on a state that captures the currently open detached widgets in anvil
anvilDetachedWidgets.currentlyOpenDetachedWidgets
This is captured and reset currently based on show and close operations of a modal.
we now have the modals that are currently open, we simply use this state to render detached widgets by extracting the widget from the
canvasWidgetsStructure
in theuseDetachedChildren
hook.PS: we are taking advantage of the fact that modal widgets can only be a child of main canvas in anvil. extracting modal states/props from
canvasWidgetsStructure
becomes more performant coz its a targetted search now.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.Anvil"
馃攳 Cypress test results
Tip
馃煝 馃煝 馃煝 All cypress tests have passed! 馃帀 馃帀 馃帀
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/8890517497
Commit: b68ad19
Cypress dashboard url: Click here!
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit