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

fix: Change the 'eventName' of each template of Custom Widget #37396

Open
wants to merge 1 commit into
base: release
Choose a base branch
from

Conversation

phennapa-saeliw
Copy link
Contributor

@phennapa-saeliw phennapa-saeliw commented Nov 15, 2024

Description

The 'eventName' of each template is incorrect, so I have renamed it.

appsmith.triggerEvent("onReset"); to appsmith.triggerEvent("onResetClick");

Fixes #37395

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.Widget"

🔍 Cypress test results

Caution

If you modify the content in this section, you are likely to disrupt the CI result for your PR.

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Updated event handling for reset actions in the React, Vanilla JS, and Vue templates to improve clarity and functionality.
  • Bug Fixes

    • Adjusted event names from "onReset" to "onResetClick" to ensure proper communication with the appsmith framework during reset actions.

Copy link
Contributor

coderabbitai bot commented Nov 15, 2024

Walkthrough

The changes in this pull request involve modifying the JavaScript event handling in three template files: react.ts, vanillaJs.ts, and vue.ts. Specifically, the event triggered by the appsmith.triggerEvent method has been updated from "onReset" to "onResetClick" in each file's uncompiledSrcDoc property. This adjustment affects how the reset action is communicated within the appsmith framework while maintaining the overall structure and functionality of the components.

Changes

Files Change Summary
app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/react.ts, vanillaJs.ts, vue.ts Updated event name in uncompiledSrcDoc from "onReset" to "onResetClick" in the handleReset function or equivalent.

Assessment against linked issues

Objective Addressed Explanation
Correctly calls appsmith.triggerEvent("onResetClick") instead of appsmith.triggerEvent("onReset") (#37395)

Possibly related PRs

  • fix: IDE Header Height usage #36297: The changes in vanillaJs.ts and vue.ts regarding the event name change from "onReset" to "onResetClick" are directly related to the modifications made in the react.ts file, as they all involve altering the event handling for reset actions in their respective files.

Suggested labels

Bug, Needs Triaging, ok-to-test, IDE Product, IDE Pod, IDE Navigation

🎉 In the land of code where events reside,
A reset was called, but it took a wild ride.
From "onReset" to "onResetClick," it now flows,
A smoother transition, as everyone knows.
With templates in sync, the bugs are now few,
Cheers to the changes, and to all of you! 🎉


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 6d524c1 and 44cccc8.

📒 Files selected for processing (3)
  • app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/react.ts (1 hunks)
  • app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/vanillaJs.ts (1 hunks)
  • app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/vue.ts (1 hunks)
🔇 Additional comments (3)
app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/react.ts (1)

69-69: LGTM! Event name updated correctly.

The change from "onReset" to "onResetClick" aligns with the requirements.

Let's verify the consistency of this change across other template files:

✅ Verification successful

Event name update verified across all template files

The change is consistently implemented across all template files (React, Vue, and Vanilla JS), with no remaining instances of the old "onReset" event name.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the event name is consistently updated across all template files
# Expected: All templates should use "onResetClick" instead of "onReset"

echo "Checking for any remaining instances of the old event name..."
rg "onReset[^C]" "app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/"

echo "Verifying the new event name is present in all template files..."
rg "onResetClick" "app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/"

Length of output: 894

app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/vue.ts (1)

110-110: LGTM! Event name updated correctly.

The change from "onReset" to "onResetClick" aligns with the requirements and fixes the reported issue #37395.

✅ Verification successful

Event name change is consistent across all template files

All template files (react.ts, vue.ts, and vanillaJs.ts) consistently use "onResetClick" as the event name, confirming the correct implementation of the change.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify consistent event name usage across all template files
rg -l "onReset\"|onResetClick\"" app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/

Length of output: 406


Script:

#!/bin/bash
# Check the actual event name usage in each template file
rg "onReset\"|onResetClick\"" app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/

Length of output: 528

app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/vanillaJs.ts (1)

111-111: LGTM! Event name updated correctly.

The event name change from "onReset" to "onResetClick" aligns with the PR objectives and maintains consistency across templates.

Let's verify the consistency of this change across other template files:

✅ Verification successful

Event name change verified across all template files

The search results confirm that "onResetClick" is consistently used across all template files (react.ts, vue.ts, and vanillaJs.ts), and there are no remaining instances of the old "onReset" event name.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify event name consistency across template files
# Expected: All templates should use "onResetClick"

# Search for any remaining instances of the old event name
rg '"onReset"' app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/

# Verify the new event name is used consistently
rg '"onResetClick"' app/client/src/pages/Editor/CustomWidgetBuilder/Editor/Header/CodeTemplates/Templates/

Length of output: 624


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 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.

@phennapa-saeliw phennapa-saeliw changed the title fix: Change the 'eventName' of each template fix: Change the 'eventName' of each template of Custom Widget Nov 15, 2024
Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants