Skip to content
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: Use zone as form #38550

Merged
merged 4 commits into from
Jan 10, 2025
Merged

chore: Use zone as form #38550

merged 4 commits into from
Jan 10, 2025

Conversation

jsartisan
Copy link
Contributor

@jsartisan jsartisan commented Jan 9, 2025

Fixes #38525

/ok-to-test tags="@tag.Anvil"

CleanShot.2025-01-08.at.17.53.37.mp4

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/12703524629
Commit: 64616e2
Cypress dashboard.
Tags: @tag.Anvil
Spec:


Fri, 10 Jan 2025 05:20:43 UTC

Summary by CodeRabbit

Release Notes

  • New Features

    • Added form validation controls for buttons
    • Introduced ability to disable buttons on invalid form
    • Added option to reset form on button click
    • New context provider for managing widget state in UI builder
  • Improvements

    • Enhanced reCAPTCHA handling with reset functionality
    • Updated button click event management
    • Improved widget context management
  • Configuration Updates

    • New form settings for button widgets
    • Added useAsForm configuration for zone widgets

These updates provide more granular control over form interactions and button behaviors.

Copy link
Contributor

coderabbitai bot commented Jan 9, 2025

Walkthrough

This pull request introduces enhancements to button and zone widget functionality across multiple files in the design system and UI builder. The changes focus on adding new properties like disableOnInvalidForm and resetFormOnClick to buttons, implementing a new context provider for zone widgets, and refining form-related interactions. The modifications aim to provide more granular control over button behavior, especially in form contexts.

Changes

File Path Change Summary
.../Button/src/types.ts Added optional disableOnInvalidForm and resetFormOnClick properties to ButtonProps
.../WDSButtonWidget/component/RecaptchaV2.tsx Renamed onPress to onClick, added onReset property
.../WDSButtonWidget/component/RecaptchaV3.tsx Similar changes to RecaptchaV2, renamed onPress to onClick, added onReset
.../WDSButtonWidget/component/index.tsx Updated ButtonComponentProps, integrated onReset and form validation logic
.../WDSButtonWidget/config/defaultsConfig.ts Renamed disabledWhenInvalid to disableOnInvalidForm
.../WDSZoneWidget/widget/context.tsx Created new context provider for widget state management
.../WDSZoneWidget/widget/index.tsx Added onReset method and useAsForm property
.../WDSButtonWidget/widget/types.ts Updated ButtonWidgetProps to omit onClick from ButtonComponentProps and added new optional onClick property
.../WDSZoneWidget/widget/config/propertyPaneContent.ts Added useAsForm property to property pane configuration

Possibly related PRs

Suggested Labels

Enhancement, IDE Product, Widgets Product, ok-to-test

Suggested Reviewers

  • sagar-qa007
  • jacquesikot
  • Nikhil-Nandagopal

Poem

🎉 Buttons dance with newfound flair,
Forms reset with a gentle care.
Validation checks, all in line,
Widgets shine, oh how they twine!
Code evolves, a joyful cheer,
In our UI, magic is near! ✨

Finishing Touches

  • 📝 Generate Docstrings

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Anvil Pod Issue related to Anvil project Task A simple Todo skip-changelog Adding this label to a PR prevents it from being listed in the changelog labels Jan 9, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🔭 Outside diff range comments (1)
app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/component/RecaptchaV2.tsx (1)

Replace any type with string for ReCAPTCHA token

        ?.executeAsync()
        .then((token: string) => {
  • Remove the TODO comment and eslint-disable directive as they're no longer needed
  • The string type is consistent with the rest of the codebase's ReCAPTCHA implementations
🔗 Analysis chain

Line range hint 42-47: Address TODO comment and improve type safety.

There's a TODO comment and an eslint disable that should be addressed.

Would you like me to help create a proper type definition for the ReCAPTCHA token to remove the eslint disable comment?

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for similar ReCAPTCHA implementations that might provide type information
rg -l "executeAsync|ReCAPTCHA" --type ts

Length of output: 221


Script:

#!/bin/bash
# Check ButtonWidget implementation
echo "=== ButtonWidget/component/index.tsx ===="
rg -A 5 "executeAsync|ReCAPTCHA" "app/client/src/widgets/ButtonWidget/component/index.tsx"

echo -e "\n=== EvaluationsSaga.ts ===="
rg -A 5 "executeAsync|ReCAPTCHA" "app/client/src/sagas/EvaluationsSaga.ts"

echo -e "\n=== Full RecaptchaV2.tsx ===="
cat "app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/component/RecaptchaV2.tsx"

Length of output: 4114


Script:

#!/bin/bash
# Check for type definitions in node_modules
echo "=== Checking for RecaptchaV2 type definitions ==="
fd -e d.ts -e ts "recaptcha" --full-path | grep -i "react.*recaptcha" | xargs cat

# Check for any local type definitions
echo -e "\n=== Checking for local type definitions ==="
fd -e ts "types" --full-path | xargs grep -l "recaptcha" || true

Length of output: 421


Script:

#!/bin/bash
# Check local type definitions
echo "=== Local type definitions ==="
cat "app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/widget/types.ts"

# Check if the token is used elsewhere in the codebase with proper typing
echo -e "\n=== Token usage patterns ==="
rg "onRecaptchaSubmitSuccess.*token" --type ts

Length of output: 1450

🧹 Nitpick comments (6)
app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/component/useRecaptcha.tsx (1)

Line range hint 21-24: Remove TODO and fix eslint disable.

The eslint disable for any[] type can be replaced with proper typing.

-  // TODO: Fix this the next time the file is edited
-  // eslint-disable-next-line @typescript-eslint/no-explicit-any
-  onClick?: (...args: any[]) => void;
+  onClick?: (onReset?: () => void) => void;
app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/component/index.tsx (1)

24-25: Consider caching the disabled state.

Since isDisabled depends on multiple props and context, consider memoizing it to prevent unnecessary re-renders.

+  const isDisabled = useMemo(
+    () => props.isDisabled || (props.disableOnInvalidForm && isFormValid === false),
+    [props.isDisabled, props.disableOnInvalidForm, isFormValid]
+  );
-  const isDisabled =
-    props.isDisabled || (props.disableOnInvalidForm && isFormValid === false);
app/client/src/modules/ui-builder/ui/wds/WDSZoneWidget/widget/context.tsx (1)

47-51: Optimize form validation logic and improve type safety.

The reduce operation could be optimized and made more type-safe.

-    return children.reduce((isValid: boolean, child: WidgetProps) => {
-      const widget = dataTree[canvasWidgets[child.widgetId].widgetName];
-
-      return "isValid" in widget ? widget.isValid && isValid : isValid;
-    }, true);
+    return children.every((child: WidgetProps) => {
+      const widget = dataTree[canvasWidgets[child.widgetId].widgetName];
+      return !("isValid" in widget) || widget.isValid;
+    });
app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/component/RecaptchaV2.tsx (1)

31-33: Simplify early return conditions.

The duplicate early return conditions can be combined.

-    if (isDisabled) return () => onClickProp?.(onReset);
-
-    if (isLoading) return () => onClickProp?.(onReset);
+    if (isDisabled || isLoading) return () => onClickProp?.(onReset);
app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/component/RecaptchaV3.tsx (1)

28-30: Consider consolidating the disabled and loading conditions.

The two conditions can be combined for better maintainability.

-    if (props.isDisabled) return () => onClickProp?.(onReset);
-
-    if (props.isLoading) return () => onClickProp?.(onReset);
+    if (props.isDisabled || props.isLoading) return () => onClickProp?.(onReset);
app/client/src/modules/ui-builder/ui/wds/WDSZoneWidget/widget/index.tsx (1)

158-164: Consider adding prop types validation

The context provider implementation is clean and well-structured. Consider adding PropTypes or TypeScript interface validation for the context provider's props.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4662317 and ee67acc.

📒 Files selected for processing (13)
  • app/client/packages/design-system/widgets/src/components/Button/src/types.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/component/RecaptchaV2.tsx (2 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/component/RecaptchaV3.tsx (2 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/component/index.tsx (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/component/useRecaptcha.tsx (2 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/config/defaultsConfig.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/config/propertyPaneConfig/contentConfig.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/widget/index.tsx (3 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/widget/types.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSZoneWidget/widget/config/defaultConfig.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSZoneWidget/widget/config/propertyPaneContent.ts (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSZoneWidget/widget/context.tsx (1 hunks)
  • app/client/src/modules/ui-builder/ui/wds/WDSZoneWidget/widget/index.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: chromatic-deployment
  • GitHub Check: storybook-tests
  • GitHub Check: chromatic-deployment
🔇 Additional comments (15)
app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/widget/types.ts (1)

12-12: LGTM! Verify event handler string evaluation.

The change from function to string type for onClick aligns with widget patterns.

Also applies to: 20-20

✅ Verification successful

Verified: onClick string property is properly handled

The change is correctly implemented using the widget system's executeAction mechanism for processing onClick string actions.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for any existing onClick string evaluations
rg -l "evaluateActionBindings.*onClick" 

Length of output: 41


Script:

#!/bin/bash
# Search for button event handling patterns
rg -l "onClick.*eval|eval.*onClick"

# Look for widget evaluation utilities
ast-grep --pattern 'function $_($$_) { $$$ eval($$_) $$$ }'

# Check ButtonWidget files for event handling
fd -e ts -e js ButtonWidget --exec rg -l "handleClick|onClick|evaluate"

Length of output: 757


Script:

#!/bin/bash
# Look for widget action handling patterns
rg -l "executeAction|processAction|handleAction" app/client/src/modules/ui-builder

# Check base widget implementations
fd -e ts BaseWidget --exec rg -l "onClick|executeAction"

# Search for action evaluation utilities
ast-grep --pattern 'class $_ extends BaseWidget { $$$ onClick($$$) { $$$ } $$$ }'

Length of output: 917


Script:

#!/bin/bash
# Check WDSButtonWidget implementation
rg -A 5 "executeAction" app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/widget/index.tsx

# Look for action execution utility
rg -A 5 "executeAction.*onClick" app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/widget/index.tsx

Length of output: 419

app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/config/defaultsConfig.ts (1)

18-19: LGTM! Clear and sensible defaults.

The property rename improves clarity, and both form-related features default to false.

app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/component/index.tsx (1)

30-35: LGTM! Clean Button implementation.

Props spreading and event handling are implemented correctly.

app/client/packages/design-system/widgets/src/components/Button/src/types.ts (1)

44-47: LGTM! Well-documented form-related button props.

The new props disableOnInvalidForm and resetFormOnClick are clearly named and enhance the button's form functionality.

app/client/src/modules/ui-builder/ui/wds/WDSZoneWidget/widget/config/defaultConfig.ts (1)

26-26: LGTM! Simple and clear addition of useAsForm property.

app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/component/RecaptchaV3.tsx (2)

20-23: Props destructuring looks good with the new onReset parameter.


46-46: LGTM! Proper handling of onReset in success callback.

app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/config/propertyPaneConfig/contentConfig.ts (1)

121-147: Well-structured form settings section with clear documentation.

The new form-related properties are properly configured with appropriate validation and helpful descriptions.

app/client/src/modules/ui-builder/ui/wds/WDSButtonWidget/widget/index.tsx (4)

Line range hint 73-91: LGTM! Clean implementation of onButtonClick with reset handling.


98-100: Simplified hasOnClickAction implementation looks good.


142-157: Props are properly passed to ButtonComponent.

All new form-related props are correctly included.


129-136: Consider adding error handling for failed form reset.

The form reset operation might fail, and it would be good to handle such cases.

app/client/src/modules/ui-builder/ui/wds/WDSZoneWidget/widget/index.tsx (3)

37-37: LGTM! Clean import statement following the project's conventions.


172-172: LGTM! Clean interface extension with proper TypeScript optional boolean prop.


147-149: Verify error handling in resetChildrenMetaProperty

The onReset implementation looks clean, but we should verify error handling in the parent method.

✅ Verification successful

Error handling verification complete - Implementation is safe

The resetChildrenMetaProperty implementation includes appropriate null checks and follows type-safe patterns through the component hierarchy.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for resetChildrenMetaProperty implementation to verify error handling
ast-grep --pattern 'resetChildrenMetaProperty(widgetId$_) {
  $$$
}'

Length of output: 70


Script:

#!/bin/bash
# Try broader ast-grep pattern for TypeScript method
ast-grep --pattern 'resetChildrenMetaProperty($_) {
  $$$
}'

# Fallback to ripgrep
echo "=== Ripgrep search ==="
rg "resetChildrenMetaProperty" -A 5

Length of output: 9859

Comment on lines +30 to +39
{
propertyName: "useAsForm",
label: "Use as a form",
helpText: "Controls the visibility of the widget",
controlType: "SWITCH",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
validation: { type: ValidationTypes.BOOLEAN },
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix incorrect helpText for useAsForm property.

The helpText "Controls the visibility of the widget" is incorrect for the useAsForm property. It should describe the form functionality instead.

-        helpText: "Controls the visibility of the widget",
+        helpText: "Enables form functionality for this zone widget",
📝 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. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{
propertyName: "useAsForm",
label: "Use as a form",
helpText: "Controls the visibility of the widget",
controlType: "SWITCH",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
validation: { type: ValidationTypes.BOOLEAN },
},
{
propertyName: "useAsForm",
label: "Use as a form",
helpText: "Enables form functionality for this zone widget",
controlType: "SWITCH",
isJSConvertible: true,
isBindProperty: true,
isTriggerProperty: false,
validation: { type: ValidationTypes.BOOLEAN },
},

}) => {
const { onReset, useAsForm, widget } = props;
const canvasWidgets = useSelector(getCanvasWidgets);
const dataTree = useSelector(getDataTree);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@riodeuno Need your review here. To track the invalid state of children's, I am tapping into data tree. Hope that's okay.

Copy link

github-actions bot commented Jan 9, 2025

🔴🔴🔴 Cyclic Dependency Check:

This PR has increased the number of cyclic dependencies by 3, when compared with the release branch.

Refer this document to identify the cyclic dependencies introduced by this PR.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🧹 Nitpick comments (1)
app/client/src/WidgetProvider/constants.ts (1)

Line range hint 1-3: Consider addressing TODO comments

Multiple TODO comments indicate pending tasks to move types to different files and fix ESLint issues. Consider addressing these in a separate cleanup PR.

Also applies to: 10-11, 49-50, 127-133, 208-210, 299-301

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ee67acc and db7f396.

📒 Files selected for processing (1)
  • app/client/src/WidgetProvider/constants.ts (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: chromatic-deployment
  • GitHub Check: chromatic-deployment
  • GitHub Check: storybook-tests
🔇 Additional comments (1)
app/client/src/WidgetProvider/constants.ts (1)

128-128: Verify derived properties compatibility

The type change from DerivedPropertiesMap to Record<string, string> might affect existing widget configurations. Please ensure all widgets using derived properties are compatible with this stricter type.

Run this script to find potential incompatibilities:

✅ Verification successful

Type change is safe - matches existing implementation

The change from DerivedPropertiesMap to Record<string, string> is safe as DerivedPropertiesMap is already defined as Record<string, string> in the codebase. This is just replacing a type alias with its actual definition.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for derived property usage in widget configurations
ast-grep --pattern 'derived: {
  $$$
}'

# Search for DerivedPropertiesMap type usage
rg "DerivedPropertiesMap"

Length of output: 14766

Copy link

github-actions bot commented Jan 9, 2025

🔴🔴🔴 Cyclic Dependency Check:

This PR has increased the number of cyclic dependencies by 2, when compared with the release branch.

Refer this document to identify the cyclic dependencies introduced by this PR.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

🧹 Nitpick comments (2)
app/client/src/reducers/entityReducers/types.ts (1)

1-6: LGTM! Consider adding JSDoc comments.

The SupportedLayouts type definition is well-structured. Consider adding JSDoc comments to document the purpose and usage of each layout type.

+/**
+ * Defines the supported layout types for the application.
+ * @typedef {string} SupportedLayouts
+ */
 export type SupportedLayouts =
   | "DESKTOP"
   | "TABLET_LARGE"
   | "TABLET"
   | "MOBILE"
   | "FLUID";
app/client/src/WidgetProvider/factory/index.tsx (1)

45-49: Consider removing the re-export to maintain a single source of truth.

The re-export with TODO comment suggests this is a transitional change. To prevent confusion and maintain a clear type definition source, consider:

  1. Updating all imports to use the new location
  2. Removing the re-export once all imports are updated

Let's verify the current usage to help with the migration:

#!/bin/bash
# Find all files importing DerivedPropertiesMap from the factory
rg "import.*DerivedPropertiesMap.*from.*WidgetProvider/factory"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between db7f396 and 8bc8255.

📒 Files selected for processing (8)
  • app/client/src/WidgetProvider/constants.ts (1 hunks)
  • app/client/src/WidgetProvider/factory/index.tsx (1 hunks)
  • app/client/src/WidgetProvider/factory/types.ts (1 hunks)
  • app/client/src/constants/WidgetConstants.tsx (1 hunks)
  • app/client/src/reducers/entityReducers/pageListReducer.tsx (1 hunks)
  • app/client/src/reducers/entityReducers/types.ts (1 hunks)
  • app/client/src/utils/autocomplete/defCreatorUtils.ts (1 hunks)
  • app/client/src/utils/autocomplete/types.ts (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • app/client/src/constants/WidgetConstants.tsx
  • app/client/src/WidgetProvider/factory/types.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/src/WidgetProvider/constants.ts
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: chromatic-deployment
  • GitHub Check: chromatic-deployment
  • GitHub Check: storybook-tests
🔇 Additional comments (6)
app/client/src/utils/autocomplete/types.ts (1)

1-1: LGTM! Good architectural decision.

Moving the ExtraDef type definition to types.ts improves code organization by centralizing type definitions.

Also applies to: 18-18

app/client/src/utils/autocomplete/defCreatorUtils.ts (2)

10-10: LGTM! Clean type re-export implementation.

The import and re-export of ExtraDef is implemented correctly, maintaining backward compatibility while improving code organization.

Also applies to: 12-12


10-12: Verify imports across the codebase.

Let's ensure all imports of ExtraDef have been updated to use the new location.

✅ Verification successful

Re-export maintains backward compatibility

The type relocation is safe as defCreatorUtils.ts re-exports the type, maintaining compatibility for existing imports.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining direct imports from defCreatorUtils
rg "import.*ExtraDef.*from.*defCreatorUtils"

# Search for new imports from types
rg "import.*ExtraDef.*from.*./types"

Length of output: 1282

app/client/src/reducers/entityReducers/pageListReducer.tsx (2)

Line range hint 284-286: LGTM! Clean interface definition.

The AppLayoutConfig interface is well-defined and correctly uses the SupportedLayouts type.


19-23: Consider tracking the TODO in an issue.

The re-export pattern is a good approach for maintaining backward compatibility. However, the TODO comment should be tracked in an issue to ensure it's addressed.

Let's check for other imports that need updating:

✅ Verification successful

Create an issue to track updating SupportedLayouts imports in 6 files

• CodeScannerWidget/component/index.tsx
• CameraWidget/component/index.tsx
• layoutConversionSagas.ts
• resolveCanvasWidth.test.ts
• resolveCanvasWidth.ts
• autoToFixedLayout.ts

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Find all files still importing SupportedLayouts from pageListReducer
rg "import.*SupportedLayouts.*from.*pageListReducer"

Length of output: 890

app/client/src/WidgetProvider/factory/index.tsx (1)

48-48: Track and address technical debt items.

The file contains multiple TODO comments and any type assertions that should be addressed:

  1. Re-export removal after import updates
  2. WidgetDerivedPropertyType typing
  3. widgetBuilderMap typing
  4. metaProperties typing in WidgetTypeConfigMap

Let's create a tracking issue for these items:

Would you like me to create a GitHub issue to track these technical debt items?

Also applies to: 54-54, 71-71, 566-566


// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
type WidgetDerivedPropertyType = any;
export type DerivedPropertiesMap = Record<string, string>;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Remove redundant type declaration.

The WidgetDerivedPropertyType is declared as any with a TODO comment. Since DerivedPropertiesMap is now properly typed as Record<string, string>, this type declaration appears to be redundant.

-// TODO: Fix this the next time the file is edited
-// eslint-disable-next-line @typescript-eslint/no-explicit-any
-type WidgetDerivedPropertyType = any;

Also applies to: 54-54

@jsartisan jsartisan added the ok-to-test Required label for CI label Jan 10, 2025
@jsartisan jsartisan merged commit 65df8d4 into release Jan 10, 2025
58 checks passed
@jsartisan jsartisan deleted the chore/make-zone-as-form branch January 10, 2025 07:18
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Feb 7, 2025
Fixes appsmithorg#38525 

/ok-to-test tags="@tag.Anvil"


https://github.com/user-attachments/assets/891ecf61-2850-46c4-acd3-b170196e5ab7



<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12703524629>
> Commit: 64616e2
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12703524629&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Anvil`
> Spec:
> <hr>Fri, 10 Jan 2025 05:20:43 UTC
<!-- end of auto-generated comment: Cypress test results  -->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

## Release Notes

- **New Features**
  - Added form validation controls for buttons
  - Introduced ability to disable buttons on invalid form
  - Added option to reset form on button click
  - New context provider for managing widget state in UI builder

- **Improvements**
  - Enhanced reCAPTCHA handling with reset functionality
  - Updated button click event management
  - Improved widget context management

- **Configuration Updates**
  - New form settings for button widgets
  - Added `useAsForm` configuration for zone widgets

These updates provide more granular control over form interactions and
button behaviors.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Anvil Pod Issue related to Anvil project ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog Task A simple Todo
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use zone as form
2 participants