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: Query Editor Routing in the redesign flow #37411

Merged
merged 1 commit into from
Nov 16, 2024

Conversation

hetunandu
Copy link
Member

@hetunandu hetunandu commented Nov 15, 2024

Description

Fixes the order of routes which caused issues in the redesign flow

Automation

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

🔍 Cypress test results

Tip

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


Fri, 15 Nov 2024 12:53:11 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features

    • Introduced a new component for adding queries, enhancing the query management experience.
    • Improved loading experience with a Skeleton display while the AddQuery component is being loaded.
  • Bug Fixes

    • Adjusted routing logic for query operations based on feature flags for better performance.

@hetunandu hetunandu added the ok-to-test Required label for CI label Nov 15, 2024
Copy link
Contributor

coderabbitai bot commented Nov 15, 2024

Walkthrough

The changes involve updating the useQueryEditorRoutes hook in the hooks.tsx file by adding a new component, AddQuery, to the routing logic. This component is included in the newComponents array and is displayed using a Suspense fallback. The AddQuery component is removed from the oldComponents array, indicating a shift in query addition handling based on the release_actions_redesign_enabled feature flag. The useAddQueryListItems hook remains unchanged, ensuring existing functionality is preserved.

Changes

File Path Change Summary
app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx - Added AddQuery component to newComponents in useQueryEditorRoutes.
- Removed AddQuery from oldComponents.
- Wrapped AddQuery in Suspense with a Skeleton fallback.

Possibly related PRs

  • chore: Plugin Action Editor routing #37389: This PR modifies the useQueryEditorRoutes hook in the same file as the main PR, enhancing the routing logic and introducing a feature flag check that aligns with the changes made to the AddQuery component in the main PR.

Suggested labels

Bug, Task, IDE Product, Query & JS Pod

Suggested reviewers

  • ayushpahwa
  • ankitakinger
  • brayn003

🌟 In the realm of code where queries dwell,
A new component joins, casting its spell.
With AddQuery wrapped in a loading embrace,
Routing logic shifts, finding its place.
Old paths are cleared, new ones arise,
In the dance of features, innovation flies! 🚀


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.

@github-actions github-actions bot added the Bug Something isn't working label Nov 15, 2024
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/Query/hooks.tsx (1)

167-169: Consider preloading the AddQuery component

The AddQuery component is loaded lazily with Suspense. Since this is a primary navigation path, consider preloading it to reduce the loading skeleton flash.

-const AddQuery = lazy(async () =>
+const AddQuery = lazy(async () => {
+  // Preload the component
+  window.requestIdleCallback(() => {
+    import(
+      /* webpackChunkName: "AddQuery" */ "pages/Editor/IDE/EditorPane/Query/Add"
+    )
+  })
+  return retryPromise(
   async () =>
     import(
       /* webpackChunkName: "AddQuery" */ "pages/Editor/IDE/EditorPane/Query/Add"
     ),
+  )
+}
 );
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between aa8b153 and db5e105.

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

171-171: Ensure path pattern consistency

The path pattern ${path}/:baseQueryId${ADD_PATH} matches the existing routing convention. However, verify that the baseQueryId parameter is handled consistently across the codebase.

#!/bin/bash
# Search for baseQueryId parameter usage
rg "baseQueryId" --type ts

163-172: Verify route precedence with existing patterns

The AddQuery route is positioned first in the newComponents array, which affects route matching priority. Ensure this ordering doesn't conflict with more specific routes like PluginActionEditor.

✅ Verification successful

Let me analyze the route patterns and component ordering to verify if there are any conflicts. The previous search didn't work well with the template literal, so I'm adjusting the search pattern.


Route ordering is correctly implemented

The route ordering in the newComponents array follows the correct precedence pattern:

  • AddQuery route with ${path}${ADD_PATH} and ${path}/:baseQueryId${ADD_PATH} comes first
  • More specific routes like PluginActionEditor with path + "/:baseQueryId" follow
  • Base path route [path] comes last

This ordering ensures that more specific routes take precedence over generic ones, preventing any routing conflicts.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for potential route pattern conflicts
rg -A 2 "path: \[.*${ADD_PATH}" 

Length of output: 7261


Script:

#!/bin/bash
# Search for route patterns in the Query editor components
rg -A 5 "path: \[.*\]" app/client/src/ce/pages/Editor/IDE/EditorPane/Query/hooks.tsx

# Search for the order of components in the routes array
ast-grep --pattern 'const newComponents = [
  $$$
]'

Length of output: 783

@hetunandu hetunandu merged commit 952fb93 into release Nov 16, 2024
47 checks passed
@hetunandu hetunandu deleted the fix/query-redesign-routing branch November 16, 2024 05:57
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Nov 20, 2024
## Description

Fixes the order of routes which caused issues in the redesign flow


## Automation

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

### 🔍 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/11855933830>
> Commit: db5e105
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11855933830&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Datasource`
> Spec:
> <hr>Fri, 15 Nov 2024 12:53:11 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Introduced a new component for adding queries, enhancing the query
management experience.
- Improved loading experience with a `Skeleton` display while the
`AddQuery` component is being loaded.

- **Bug Fixes**
- Adjusted routing logic for query operations based on feature flags for
better performance.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@coderabbitai coderabbitai bot mentioned this pull request Dec 30, 2024
2 tasks
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants