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

Merged
merged 8 commits into from
Jun 9, 2025
Merged

fix: code editor changes #40239

merged 8 commits into from
Jun 9, 2025

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/15493848736
Commit: f993e21
Cypress dashboard.
Tags: @tag.JS
Spec:


Fri, 06 Jun 2025 16:05:30 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • Refactor
    • Streamlined change handling in the code editor for more consistent updates using a standardized debounce timer.
  • Bug Fixes
    • Improved auto-save reliability by adding a delay before save status checks to prevent premature assertions.
  • New Features
    • Introduced a configurable save delay constant to unify save operation timing across the editor.

@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 removes the changeStarted flag from the CodeEditor component and consolidates the logic for triggering startingEntityUpdate and input changes exclusively within handleChange under stricter conditions. The debounce delay is centralized via a new constant. Additionally, a 600ms plus 100ms sleep delay was added at the start of the AssertAutoSave method in Cypress test support.

Changes

File(s) Change Summary
app/client/src/components/editorComponents/CodeEditor/index.tsx Removed changeStarted flag and related state; simplified handleChange to trigger startingEntityUpdate only if editor value differs and editor is focused; removed startChange logic; replaced hardcoded debounce delay with SAVE_TRIGGER_DELAY_MS constant.
app/client/src/components/editorComponents/CodeEditor/debounceConstants.ts Added and exported SAVE_TRIGGER_DELAY_MS constant with value 600.
app/client/cypress/support/Pages/AggregateHelper.ts Imported SAVE_TRIGGER_DELAY_MS and added a sleep delay of SAVE_TRIGGER_DELAY_MS + 100ms at the start of AssertAutoSave method before existing assertions.

Suggested labels

High, Git Product

Suggested reviewers

  • ankitakinger

Poem

The flag is gone, the code refined,
Change flows clear, no state confined.
A pause to wait, then tests proceed,
Smooth edits now fulfill the need.
Cleaner paths and steady pace,
Code and tests in perfect grace! 🚀✨


📜 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 e094505 and f993e21.

📒 Files selected for processing (1)
  • app/client/cypress/support/Pages/AggregateHelper.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/cypress/support/Pages/AggregateHelper.ts
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-build / client-build
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
✨ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 generate sequence diagram to generate a sequence diagram of the changes in this 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.

@github-actions github-actions bot added the Bug Something isn't working label Apr 14, 2025
sneha122
sneha122 previously approved these changes 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
Copy link

This PR has been closed because of inactivity.

@github-actions github-actions bot closed this Apr 29, 2025
Copy link

This PR has been closed because of inactivity.

@sneha122 sneha122 reopened this Jun 3, 2025
@sneha122 sneha122 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 3, 2025
@sneha122 sneha122 added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Jun 4, 2025
@sneha122 sneha122 requested a review from ApekshaBhosale as a code owner June 4, 2025 07:28
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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5105c48 and 08d87e7.

📒 Files selected for processing (2)
  • app/client/cypress/support/Pages/AggregateHelper.ts (1 hunks)
  • app/client/src/components/editorComponents/CodeEditor/index.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/client/src/components/editorComponents/CodeEditor/index.tsx
🧰 Additional context used
📓 Path-based instructions (1)
`app/client/cypress/**/**.*`: Review the following e2e test code written using the Cypress test library. Ensure that: - Follow best practices for Cypress code and e2e automation. ...

app/client/cypress/**/**.*: Review the following e2e test code written using the Cypress test library. Ensure that:

  • Follow best practices for Cypress code and e2e automation.
  • Avoid using cy.wait in code.
  • Avoid using cy.pause in code.
  • Avoid using agHelper.sleep().
  • Use locator variables for locators and do not use plain strings.
  • Use data-* attributes for selectors.
  • Avoid Xpaths, Attributes and CSS path.
  • Avoid selectors like .btn.submit or button[type=submit].
  • Perform logins via API with LoginFromAPI.
  • Perform logout via API with LogOutviaAPI.
  • Perform signup via API with SignupFromAPI.
  • Avoid using it.only.
  • Avoid using after and aftereach in test cases.
  • Use multiple assertions for expect statements.
  • Avoid using strings for assertions.
  • Do not use duplicate filenames even with different paths.
  • Avoid using agHelper.Sleep, this.Sleep in any file in code.
  • app/client/cypress/support/Pages/AggregateHelper.ts
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-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-unit-tests / client-unit-tests
  • GitHub Check: client-prettier / prettier-check

@sneha122 sneha122 requested a review from rahulbarwal June 5, 2025 11:31
rahulbarwal
rahulbarwal previously approved these changes Jun 5, 2025
@sneha122 sneha122 removed the ok-to-test Required label for CI label Jun 5, 2025
@sneha122 sneha122 requested a review from rahulbarwal June 5, 2025 12:38
@sneha122 sneha122 added the ok-to-test Required label for CI label Jun 6, 2025
rahulbarwal
rahulbarwal previously approved these changes Jun 6, 2025
@sneha122 sneha122 merged commit 99db0a1 into release Jun 9, 2025
45 checks passed
@sneha122 sneha122 deleted the test76 branch June 9, 2025 05:51
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.

3 participants