-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: [Plugin Action Editor] Defer plugin config checks #37655
chore: [Plugin Action Editor] Defer plugin config checks #37655
Conversation
WalkthroughThe changes in this pull request involve modifications to the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
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: 0
🧹 Outside diff range and nitpick comments (5)
app/client/src/PluginActionEditor/PluginActionContext.tsx (1)
Line range hint
28-47
: Well-structured context implementation.The context provider maintains proper type safety while supporting the new optional configs. The useMemo optimization ensures efficient re-renders only when dependencies change.
Consider documenting the optional nature of these configs in JSDoc comments to help other developers understand when they can be omitted.
app/client/src/pages/Editor/ActionSettings.tsx (2)
8-8
: Consider using path aliases for cleaner importsThe relative import path could be simplified using path aliases to improve maintainability.
-import CenteredWrapper from "../../components/designSystems/appsmith/CenteredWrapper"; +import CenteredWrapper from "@design-system/CenteredWrapper";
Line range hint
11-14
: Consider addressing technical debtThe TODO comments and
any
types should be addressed to improve type safety. Consider defining proper interfaces foractionSettingsConfig
.interface ActionSettingsConfig { children: Array<{ configProperty: string; // Add other necessary properties } | { children: ActionSettingsConfig[]; }>; } interface ActionSettingsProps { actionSettingsConfig: ActionSettingsConfig[]; formName: string; theme?: EditorTheme; }app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/FormRender.tsx (2)
269-275
: Consider preserving the refresh functionalityWhile the new error UI is cleaner, it removes the refresh capability that was present in the original ErrorComponent. Consider adding a refresh button for better user experience.
return ( <CenteredWrapper> <Text color="var(--ads-v2-color-fg-error)" kind="heading-m"> {createMessage(UNEXPECTED_ERROR)} </Text> + <Button + kind="secondary" + size="sm" + onClick={() => window.location.reload()} + > + {createMessage(ACTION_EDITOR_REFRESH)} + </Button> </CenteredWrapper> );
Line range hint
29-33
: Technical Debt: Address TODOs and type safetyMultiple TODOs and eslint-disable comments indicate areas needing improvement:
- Props interface has an
any
type for editorConfig- Several functions use
any
type for section parameters- Type assertions could be replaced with proper typing
Consider creating a technical debt ticket to address these issues.
Would you like me to help create proper TypeScript interfaces for these components?
Also applies to: 91-93, 156-158, 184-186, 249-251
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (4)
app/client/src/PluginActionEditor/PluginActionContext.tsx
(1 hunks)app/client/src/PluginActionEditor/PluginActionEditor.tsx
(0 hunks)app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/FormRender.tsx
(2 hunks)app/client/src/pages/Editor/ActionSettings.tsx
(2 hunks)
💤 Files with no reviewable changes (1)
- app/client/src/PluginActionEditor/PluginActionEditor.tsx
🔇 Additional comments (3)
app/client/src/PluginActionEditor/PluginActionContext.tsx (1)
15-16
: LGTM! Making configs optional aligns with the PR objective.
The change to make editorConfig
and settingsConfig
optional matches the goal of deferring plugin config checks.
Let's verify that components using these configs handle the optional case properly:
✅ Verification successful
Let me try another search strategy to verify the usage of these optional configs.
Making configs optional is safe - proper null checks are in place
The codebase properly handles the optional nature of editorConfig
and settingsConfig
:
- FormRender.tsx has explicit null check:
if (!editorConfig || editorConfig.length < 0)
- Optional chaining is used in component props:
editorConfig={editorConfig}
- Values are safely merged in hooks with proper type checks
- Context values are memoized to prevent unnecessary renders
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for direct usage of editorConfig and settingsConfig
ast-grep --pattern 'editorConfig.$$$'
ast-grep --pattern 'settingsConfig.$$$'
# Search for null checks or optional chaining
rg -A 2 'editorConfig\??\.'
rg -A 2 'settingsConfig\??\.'
Length of output: 152384
Script:
#!/bin/bash
# Search for direct usage of editorConfig and settingsConfig in the PluginActionEditor directory
rg -A 3 'editorConfig|settingsConfig' app/client/src/PluginActionEditor/
Length of output: 11888
app/client/src/pages/Editor/ActionSettings.tsx (1)
47-51
: LGTM! Clean implementation of error state UI
The error handling implementation using CenteredWrapper and Text components follows design system guidelines and improves error visibility.
app/client/src/PluginActionEditor/components/PluginActionForm/components/UQIEditor/FormRender.tsx (1)
25-26
: LGTM: Clean import additions
The new imports align with the project's design system and are appropriately used for error message presentation.
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: 0
🧹 Outside diff range and nitpick comments (1)
app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx (1)
16-24
: Consider adding more specific error informationWhile the error handling is well-implemented, the generic error message might not be helpful for debugging. Consider including more context about the missing editorConfig.
- {createMessage(UNEXPECTED_ERROR)} + {`${createMessage(UNEXPECTED_ERROR)}: Plugin Action Editor configuration is missing`}
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
📒 Files selected for processing (1)
app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx
(1 hunks)
🔇 Additional comments (2)
app/client/src/PluginActionEditor/components/PluginActionForm/PluginActionForm.tsx (2)
2-2
: LGTM: Import statements are properly organized
The new imports are correctly placed and follow the project's conventions.
Also applies to: 9-10
14-14
: Verify the optional editorConfig handling across components
The change to make editorConfig
optional aligns with the PR objective but requires verification of proper handling in other components.
✅ Verification successful
The previous search revealed usage of editorConfig in multiple components, but we need to:
- Check actual usage of editorConfig properties
- Verify if the type definition makes it optional
- Find any potential null checks for editorConfig
This will help us determine if the optionality is properly handled across the codebase.
The previous results show that editorConfig
is marked as optional in the context type and interfaces, but we need to verify:
- How the code handles the optional nature through null checks
- Which components actually use editorConfig
- If there are any conditional renders based on editorConfig presence
This will help us confirm proper handling of the optional editorConfig across the codebase.
Optional editorConfig is properly handled across the codebase
The type definition in PluginActionContext.tsx
already marks editorConfig
as optional (editorConfig?: unknown[]
), and this optionality is consistently reflected in component interfaces where it's used (FormRender.tsx, Editor.tsx). The change aligns with the existing type system and component implementations.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for other components using editorConfig from the plugin action context
ast-grep --pattern 'const { $$$, editorConfig, $$$ } = usePluginActionContext()'
# Search for direct editorConfig usage
rg "editorConfig\." --type ts --type tsx
Length of output: 2388
Script:
#!/bin/bash
# Search for editorConfig usage with proper file types
rg "editorConfig\." -t typescript -t tsx
# Search for type definition of usePluginActionContext
ast-grep --pattern 'interface $_ {
$$$
editorConfig
$$$
}'
# Search for editorConfig optional marker
ast-grep --pattern 'editorConfig?: $_'
Length of output: 8043
Script:
#!/bin/bash
# Search for editorConfig usage and null checks
rg "editorConfig(\?|\s+&&|\s*\|\|)" -t ts -t tsx
# Search for files that use editorConfig
fd -e ts -e tsx -x grep -l "editorConfig"
# Look for conditional rendering with editorConfig
ast-grep --pattern 'editorConfig ? $_ : $_'
Length of output: 4305
…#37655) ## Description Updates Plugin Action Editor to defer the plugin check till needed. This ensures the usage of Plugin Action Context in scenarios the config is not needed. Eg: If we want to show Plugin Action Response in App View Mode but not the form, we can still use the Plugin Action Editor with its context. ## Automation /ok-to-test tags="@tag.All" ### 🔍 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/11973235246> > Commit: 88d7be1 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11973235246&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `@tag.All` > Spec: > <hr>Fri, 22 Nov 2024 14:25:16 UTC <!-- 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 ## Release Notes - **New Features** - Enhanced error message presentation with centered layout in various components. - Improved rendering logic for form configurations, ensuring clearer separation based on type. - **Bug Fixes** - Simplified error handling in the `PluginActionEditor` component, removing unnecessary error checks. - Updated error handling in the `ActionSettings` component to improve message display. - **Documentation** - Updated error handling and rendering logic for better user experience. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Description
Updates Plugin Action Editor to defer the plugin check till needed. This ensures the usage of Plugin Action Context in scenarios the config is not needed.
Eg: If we want to show Plugin Action Response in App View Mode but not the form, we can still use the Plugin Action Editor with its context.
Automation
/ok-to-test tags="@tag.All"
🔍 Cypress test results
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11973235246
Commit: 88d7be1
Cypress dashboard.
Tags:
@tag.All
Spec:
Fri, 22 Nov 2024 14:25:16 UTC
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
PluginActionEditor
component, removing unnecessary error checks.ActionSettings
component to improve message display.Documentation