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: [Plugin Action Editor] Implement a useIsEditorIsInitialised hook #36328

Merged
merged 29 commits into from
Sep 16, 2024

Conversation

hetunandu
Copy link
Member

@hetunandu hetunandu commented Sep 16, 2024

Description

Implements a new IDE level hook that looks at the editor state and returns it. This hook gets overriden with EE logic.

EE PR: https://github.com/appsmithorg/appsmith-ee/pull/5151

Related to #34324

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10882119504
Commit: 330560e
Cypress dashboard.
Tags: @tag.IDE
Spec:


Mon, 16 Sep 2024 11:06:52 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced a new hook, useIsEditorInitialised, for improved management of the editor's initialization state.
    • Enhanced the PluginActionEditor component to utilize the new hook, streamlining the initialization state access.
  • Bug Fixes

    • Removed reliance on Redux for the editor's initialization state in favor of the new hook, improving performance and readability.

Copy link
Contributor

coderabbitai bot commented Sep 16, 2024

Walkthrough

The pull request introduces a new custom React hook, useIsEditorInitialised, which centralizes the management of the editor's initialization state. This hook replaces the previous Redux selector approach in the PluginActionEditor component, enhancing modularity and readability. Additionally, the hook is exported for use in other parts of the application, promoting code reusability.

Changes

File Path Change Summary
app/client/src/IDE/hooks/index.ts Added export for useIsEditorInitialised from ee/IDE/hooks/useIsEditorInitialised.
app/client/src/PluginActionEditor/PluginActionEditor.tsx Replaced Redux selector with useIsEditorInitialised for determining editor initialization state. Removed the import for the selector.
app/client/src/ce/IDE/hooks/useIsEditorInitialised.ts Introduced useIsEditorInitialised hook utilizing useSelector to access editor initialization status.
app/client/src/ee/IDE/hooks/useIsEditorInitialised.ts Exported useIsEditorInitialised hook from the ce/IDE/hooks/useIsEditorInitialised module.

Possibly related PRs

Suggested labels

Task

Poem

In the land of code where hooks do play,
A new friend joins, brightening the way.
useIsEditorInitialised, a name so fine,
Makes checking state a breeze, oh how divine!
With Redux set aside, we cheer and sing,
For cleaner code and joy this change will bring! 🎉


Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 996e26b and 330560e.

Files selected for processing (4)
  • app/client/src/IDE/hooks/index.ts (1 hunks)
  • app/client/src/PluginActionEditor/PluginActionEditor.tsx (2 hunks)
  • app/client/src/ce/IDE/hooks/useIsEditorInitialised.ts (1 hunks)
  • app/client/src/ee/IDE/hooks/useIsEditorInitialised.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • app/client/src/ee/IDE/hooks/useIsEditorInitialised.ts
Additional comments not posted (5)
app/client/src/IDE/hooks/index.ts (1)

2-2: Great work on adding the useIsEditorInitialised hook export! 👍

This hook will be quite useful for components that need to know the editor's initialization state. It allows them to render or perform actions based on whether the editor is ready or not. 📝

Since the hook is imported from the Enterprise Edition (EE) path, it may have additional functionality or different behavior compared to the Community Edition (CE) version. Make sure to document any differences or enhancements in the hook's implementation. 📚

Keep up the good work! Let me know if you have any questions or need further assistance. 🙋‍♂️

app/client/src/ce/IDE/hooks/useIsEditorInitialised.ts (2)

1-2: Great job with the imports, class!

The useSelector hook from react-redux and the getIsEditorInitialized selector from selectors/editorSelectors are correctly imported. These imports are essential for the hook implementation.


4-6: Excellent work on the custom hook, students!

The useIsEditorInitialised hook is a great example of encapsulating complex logic and promoting a modular approach to state management. By utilizing the useSelector hook and the getIsEditorInitialized selector, the hook provides an easy way for components to access the editor's initialization status without directly interacting with the Redux store.

This approach leads to cleaner and more maintainable code, as the state management logic is abstracted away from the components. Well done!

app/client/src/PluginActionEditor/PluginActionEditor.tsx (2)

18-18: Excellent work on transitioning to a custom hook! 👏

The shift from using a Redux selector to a custom hook for accessing the editor's initialization state is a great improvement. This change leverages React's hooks system, which can enhance the component's performance and readability.

By encapsulating the logic within a hook, you've provided a more streamlined and context-aware approach to accessing the initialization state. Well done!


27-27: Great job on consistently using the new custom hook! 🙌

The usage of the useIsEditorInitialised hook here aligns perfectly with the overall objective of the PR to implement a new IDE-level hook for examining the editor state. By replacing the Redux selector with the custom hook, you've maintained consistency and adhered to the new approach.

This change demonstrates a clear understanding of the PR's goals and a commitment to implementing the new hook throughout the component. Keep up the excellent work!


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 generate interesting stats about this repository and render them as a table.
    -- @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.

@hetunandu hetunandu changed the title Chore/use editor initialised hook chore: [Plugin Action Editor] Implement a useIsEditorIsInitialised hook Sep 16, 2024
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Sep 16, 2024
@hetunandu hetunandu added IDE Product Issues related to the IDE Product IDE Pod Issues that new developers face while exploring the IDE ok-to-test Required label for CI labels Sep 16, 2024
@hetunandu hetunandu marked this pull request as ready for review September 16, 2024 09:25
@hetunandu hetunandu added ok-to-test Required label for CI and removed IDE Pod Issues that new developers face while exploring the IDE ok-to-test Required label for CI labels Sep 16, 2024
@hetunandu hetunandu merged commit 4dcec5f into release Sep 16, 2024
88 checks passed
@hetunandu hetunandu deleted the chore/use-editor-initialised-hook branch September 16, 2024 11:10
Shivam-z pushed a commit to Shivam-z/appsmith that referenced this pull request Sep 26, 2024
…ok (appsmithorg#36328)

## Description

Implements a new IDE level hook that looks at the editor state and
returns it. This hook gets overriden with EE logic.

EE PR: https://github.com/appsmithorg/appsmith-ee/pull/5151


Related to appsmithorg#34324

## Automation

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

### 🔍 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/10882119504>
> Commit: 330560e
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10882119504&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.IDE`
> Spec:
> <hr>Mon, 16 Sep 2024 11:06:52 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

- **New Features**
- Introduced a new hook, `useIsEditorInitialised`, for improved
management of the editor's initialization state.
- Enhanced the `PluginActionEditor` component to utilize the new hook,
streamlining the initialization state access.

- **Bug Fixes**
- Removed reliance on Redux for the editor's initialization state in
favor of the new hook, improving performance and readability.

<!-- 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
IDE Product Issues related to the IDE Product ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants