Skip to content

fix: clicking on + in list view does not create a new query#36467

Merged
hetunandu merged 3 commits intoappsmithorg:releasefrom
a6hishekpandey:fix/36066-clicking-on-plus-in-list-view-does-not-create-new-query
Sep 30, 2024
Merged

fix: clicking on + in list view does not create a new query#36467
hetunandu merged 3 commits intoappsmithorg:releasefrom
a6hishekpandey:fix/36066-clicking-on-plus-in-list-view-does-not-create-new-query

Conversation

@a6hishekpandey
Copy link
Contributor

@a6hishekpandey a6hishekpandey commented Sep 22, 2024

Description

This change adds a new state in ideReducer 'isListViewActive' to verify the active status of the list view on split screen mode. I am updating isListViewActive state to false when we click on + icon and are already in QUERY_ADD mode, to close the list view and switch back to the new query tab.

Fixes #36066
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=""

🔍 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

    • Introduced a new action to manage the active state of the list view, enhancing user interface control.
    • Added a selector to retrieve the current state of the list view.
  • Improvements

    • Updated the useQueryAdd and useJSAdd hooks to respond to the IDE's view mode, improving functionality when adding queries.
    • Shifted state management for the list view from local to global, ensuring consistent visibility across the application.
  • Bug Fixes

    • Enhanced responsiveness of the list view based on the current interface state.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 22, 2024

Walkthrough

The pull request introduces several changes to manage the active state of a list view within the IDE. It adds a new action creator, action type, and selector to facilitate this state management using Redux. Additionally, modifications are made to existing hooks and components to utilize the new state management approach, enhancing the responsiveness of the application interface.

Changes

File Path Change Summary
app/client/src/actions/ideActions.ts Added setListViewActiveState(payload: boolean) function to manage list view active state.
app/client/src/ce/constants/ReduxActionConstants.tsx Introduced new action type constant SET_IS_LIST_VIEW_ACTIVE.
app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx Updated useQueryAdd hook to integrate ideViewMode state and dispatch setListViewActiveState.
app/client/src/pages/Editor/IDE/EditorTabs/index.tsx Removed local state management for list view; implemented Redux actions for global state control.
app/client/src/reducers/uiReducers/ideReducer.ts Added isListViewActive property to IDEState and action handler for SET_IS_LIST_VIEW_ACTIVE.
app/client/src/selectors/ideSelectors.tsx Added getListViewActiveState selector to retrieve list view active state from Redux store.

Assessment against linked issues

Objective Addressed Explanation
User should be redirected to New Query tab on + click (36066)
Ensure list view functionality is correctly integrated (36066)

🎉 In the code, a new state takes flight,
Managing views, making everything right.
With Redux in charge, the list view shines,
Click the +, and new queries align!
A seamless flow, like a dance so sweet,
In our IDE, where all features meet! 🌟


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.

@a6hishekpandey
Copy link
Contributor Author

@albinAppsmith can you please review the PR whenever you have sometime, and let me know if you have any suggestions on the same

@albinAppsmith
Copy link
Contributor

@a6hishekpandey I'm looking into this :)

@a6hishekpandey
Copy link
Contributor Author

@albinAppsmith okay, thankyou

@albinAppsmith
Copy link
Contributor

@a6hishekpandey, I’ve identified an issue in the enterprise edition related to this PR. I will review and address it before proceeding with the merge.

@albinAppsmith
Copy link
Contributor

albinAppsmith commented Sep 26, 2024

@a6hishekpandey, could you please apply the same changes made in app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx to app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.ts as well?

Thank you.

@a6hishekpandey
Copy link
Contributor Author

@a6hishekpandey, could you please apply the same changes made in app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx to app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.ts as well?

Thank you.

@albinAppsmith, we don't need those changes in JS as we are generating entire object with a default name so whenever we click on the plus from listview it will add a new js object and make that tab active, this problem will occur only in the case of QUERY as we have to select one type (ex: REST API) after the add button clicked.

@albinAppsmith
Copy link
Contributor

albinAppsmith commented Sep 26, 2024

@a6hishekpandey, could you please apply the same changes made in app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx to app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.ts as well?
Thank you.

@albinAppsmith, we don't need those changes in JS as we are generating entire object with a default name so whenever we click on the plus from listview it will add a new js object and make that tab active, this problem will occur only in the case of QUERY as we have to select one type (ex: REST API) after the add button clicked.

@a6hishekpandey the behaviour you explained is different in enterprise version and if you check the else part in openAddJS function you will see the similar structure as query add hook.

@a6hishekpandey
Copy link
Contributor Author

@a6hishekpandey, could you please apply the same changes made in app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx to app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.ts as well?
Thank you.

@albinAppsmith, we don't need those changes in JS as we are generating entire object with a default name so whenever we click on the plus from listview it will add a new js object and make that tab active, this problem will occur only in the case of QUERY as we have to select one type (ex: REST API) after the add button clicked.

@a6hishekpandey the behaviour you explained is different in enterprise version and if you check the else part in openAddJS function you will see the similar structure as query add hook.

okay, sure I will go through it and make the required changes.

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

🧹 Outside diff range and nitpick comments (1)
app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.ts (1)

30-54: Excellent work on updating the useJSAdd hook!

You've made some smart changes here:

  1. Adding the ideViewMode selector.
  2. Implementing the new condition for split screen mode.
  3. Updating the dependency array.

However, let's make one small improvement to enhance readability:

Consider extracting the new condition into a separate function. This will make the code more readable and easier to test. Here's an example:

const handleSplitScreenMode = () => {
  if (ideViewMode === EditorViewMode.SplitScreen) {
    dispatch(setListViewActiveState(false));
  }
};

// Then in openAddJS:
if (currentEntityInfo.entity === FocusEntity.JS_OBJECT_ADD) {
  handleSplitScreenMode();
  return;
}

This change will make your code even more organized and easier to understand. Keep up the great work!

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between d6cb870 and 6b8b638.

📒 Files selected for processing (1)
  • app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.ts (2 hunks)
🔇 Additional comments not posted (2)
app/client/src/ce/pages/Editor/IDE/EditorPane/JS/hooks.ts (2)

18-20: Well done, class! These new imports are spot on.

You've correctly added the necessary imports for the new functionality. Remember, good code organization starts with proper imports!


30-54: Let's review our lesson plan, shall we?

Class, we've made some changes to address the '+' icon functionality in the list view. However, I have a few questions:

  1. The PR objectives mention QUERY_ADD mode, but this file handles JS object creation. Can you explain how this change aligns with the original issue?
  2. In the PR comments, it was mentioned that changes weren't necessary for JS hooks. Yet, we've implemented similar changes here. Could you clarify the reasoning behind this decision?
  3. How does this change interact with the enterprise version mentioned in the comments?

Let's discuss these points to ensure we're on the right track with our lesson plan.

@a6hishekpandey
Copy link
Contributor Author

@albinAppsmith, I did the required changes in openAddJS function as well, can you please check whenever you will have sometime?

@albinAppsmith
Copy link
Contributor

All tests passed in both CE and EE.

CE: #36526
EE: https://github.com/appsmithorg/appsmith-ee/pull/5224

@hetunandu hetunandu merged commit 37c2cf5 into appsmithorg:release Sep 30, 2024
@a6hishekpandey
Copy link
Contributor Author

@albinAppsmith and @hetunandu, I had fixed one more issue but closed it as no one looked into it and was not sure if the fix I did was to be did like that, If someone can help me with the PR I can reopen it #36367. Please have a look if you guys have sometime.

@albinAppsmith
Copy link
Contributor

@a6hishekpandey This problem needs to be discussed internally before getting into that solution. I will get back to you on this.

@a6hishekpandey
Copy link
Contributor Author

@a6hishekpandey This problem needs to be discussed internally before getting into that solution. I will get back to you on this.

@albinAppsmith okay, sure

@a6hishekpandey a6hishekpandey deleted the fix/36066-clicking-on-plus-in-list-view-does-not-create-new-query branch October 1, 2024 05:47
@albinAppsmith
Copy link
Contributor

@a6hishekpandey This fix involves some internal discussions and design decisions, so it's best to set it aside for now. Feel free to explore other issues from our Inviting Contribution list.

Happy contributing 🙂

@a6hishekpandey
Copy link
Contributor Author

@albinAppsmith okay, thanks for the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Clicking on + in list view does not create a new query

3 participants