Skip to content

fix: code editor changes #40239

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

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

fix: code editor changes #40239

wants to merge 1 commit into from

Conversation

vsvamsi1
Copy link
Contributor

@vsvamsi1 vsvamsi1 commented Apr 14, 2025

Description

We've encountered a bug in the REST API plugin where rapidly changing the URL input causes the save status to get stuck in the loading state. This happens because the evaluation is debounced, and by the time it's ready to run, the inputs may have changed in a way that prevents the evaluation from being triggered. However, we still initiate a saga that tracks the terminal state and controls the loading status. Since the evaluation never actually occurs, the terminal state is never reached, causing the loading status to remain stuck.

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

🔍 Cypress test results

Caution

🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/14443305740
Commit: b0924e7
Cypress dashboard.
Tags: @tag.All
Spec:
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ClientSide/ActionExecution/ActionSelector_JsToNonJSMode_4_spec.ts
  2. cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_CopyToClipboardFunctions_spec.ts
  3. cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_DownloadFunctions_spec.ts
  4. cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_LocalStoreValueFunctions_spec.ts
  5. cypress/e2e/Regression/ClientSide/ActionExecution/FrameworkFunctions_ResetWidgetFunctions_spec.ts
  6. cypress/e2e/Regression/ClientSide/ActionExecution/StoreValue_spec.ts
  7. cypress/e2e/Regression/ClientSide/Autocomplete/Autocomplete_setters_spec.ts
  8. cypress/e2e/Regression/ClientSide/Autocomplete/Bugs_AC_Spec.ts
  9. cypress/e2e/Regression/ClientSide/BugTests/DS_Bug28985_spec.ts
  10. cypress/e2e/Regression/ClientSide/Debugger/JSObjects_navigation_spec.ts
  11. cypress/e2e/Regression/ClientSide/JSLibrary/Custom_lib_spec.ts
  12. cypress/e2e/Regression/ClientSide/JSObject/JSObject_Tests_spec.ts
  13. cypress/e2e/Regression/ClientSide/Linting/ErrorReporting_spec.ts
  14. cypress/e2e/Regression/ClientSide/Widgets/TableV2/TableV2_Widget_Add_button_spec.js
  15. cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/checkboxCell_spec.js
  16. cypress/e2e/Regression/ClientSide/Widgets/TableV2/columnTypes/switchCell_spec.js
List of identified flaky tests.
Mon, 14 Apr 2025 12:47:10 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • Refactor
    • Streamlined the change handling logic in the code editor to ensure efficient and consistent update processing.

@vsvamsi1 vsvamsi1 added the ok-to-test Required label for CI label Apr 14, 2025
@vsvamsi1 vsvamsi1 requested a review from sneha122 April 14, 2025 10:23
@vsvamsi1 vsvamsi1 self-assigned this Apr 14, 2025
Copy link
Contributor

coderabbitai bot commented Apr 14, 2025

Walkthrough

The pull request simplifies the CodeEditor component by removing the changeStarted boolean state and its associated logic. The handleChange and startChange methods no longer rely on this flag to handle entity changes. Instead, the component now directly verifies if the current value differs from the new input and if the editor is focused, triggering the startingEntityUpdate action accordingly. This adjustment streamlines state management within the editor without altering its core functionality.

Changes

File(s) Change Summary
app/client/src/components/editorComponents/CodeEditor/index.tsx Removed the changeStarted state from the State interface and eliminated related conditional logic in the handleChange and startChange methods.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant E as CodeEditor
    participant A as Entity Update Action

    U->>E: Trigger change event with new value
    E->>E: Check if new value != current value and editor is focused
    E->>A: Call startingEntityUpdate action if conditions met
Loading

Poem

In the code’s quiet hall of state,
A flag was removed to simplify the fate,
No more extra checks in the flow,
Just clear updates, steady and slow.
Code shines bright, errors take flight!
🚀💻 Happy coding, day and night!

Tip

⚡💬 Agentic Chat (Pro Plan, General Availability)
  • We're introducing multi-step agentic chat in review comments and issue comments, within and outside of PR's. This feature enhances review and issue discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments and add commits to existing pull requests.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 88484a4 and b0924e7.

📒 Files selected for processing (1)
  • app/client/src/components/editorComponents/CodeEditor/index.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-build / client-build
  • GitHub Check: client-prettier / prettier-check
🔇 Additional comments (1)
app/client/src/components/editorComponents/CodeEditor/index.tsx (1)

1310-1323: Approved simplification of handleChange

The refactoring simplifies state management by directly checking if the current value differs from the input value and if the editor is focused. This should fix the issue where rapidly changing the URL input caused the save status to get stuck in a loading state.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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 the Bug Something isn't working label Apr 14, 2025
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 Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working ok-to-test Required label for CI Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants