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: New query button does not show up issue fixed #36766

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

sneha122
Copy link
Contributor

@sneha122 sneha122 commented Oct 8, 2024

Description

This PR fixes two issues:

  1. When importing older application jsons with applicationVersion 1, they get redirected to /applications (older url) as opposed to /app (newer slug based url). This results in new query button not showing up on datasource view page, because new query button is hidden behind a condition of editorType and editorType was depending on the new url path. This PR fixes the issue by adding support for older path as well to provide backwards compatibility.
  2. Second similar issue was seen intermittently, when we do save and authorise in REST API datasource, then sometimes the redirection was happening to older url (/applications), in that case new query button would not show up. This has been fixed too

Fixes #35626
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.Sanity"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/11240765031
Commit: 015ef2a
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Tue, 08 Oct 2024 18:19:47 UTC

Communication

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

  • Yes
  • No

@sneha122 sneha122 requested a review from ankitakinger October 8, 2024 17:36
Copy link
Contributor

coderabbitai bot commented Oct 8, 2024

Walkthrough

The changes introduce a new test suite for the useEditorType hook in the hooks.test.ts file, validating its behavior with specific input paths. Additionally, the index.ts file is modified to include a new constant, BUILDER_BASE_PATH_DEPRECATED, which maps to EditorNames.APPLICATION. The useEditorType function is updated to accommodate this new path, ensuring proper matching alongside existing constants.

Changes

File Change Summary
app/client/src/ce/hooks/hooks.test.ts Added a new test suite for useEditorType with three test cases for specific paths.
app/client/src/ce/hooks/index.ts Introduced BUILDER_BASE_PATH_DEPRECATED constant and updated editorType mapping accordingly.

Suggested labels

Bug, Needs Triaging, ok-to-test

🎉 In the land of code where functions play,
A new test suite brightens the day!
With paths defined, and constants in line,
The useEditorType now works just fine.
So let’s celebrate this coding delight,
For every test run brings joy and insight! 🌟


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 Oct 8, 2024
@sneha122 sneha122 added the ok-to-test Required label for CI label Oct 8, 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/hooks/hooks.test.ts (1)

8-24: Wonderful test cases, class!

Your test cases are like well-crafted exam questions, covering different scenarios for the useEditorType function. Here's a gold star for your efforts!

However, to make your tests even better, consider this small improvement:

Add a test case for the BUILDER_PATH_PREFIX constant. This will ensure complete coverage of all possible path prefixes. Here's an example:

it('should return "app" for BUILDER_PATH_PREFIX', () => {
  const result = useEditorType(BUILDER_PATH_PREFIX);
  expect(result).toBe(EditorNames.APPLICATION);
});

Don't forget to import BUILDER_PATH_PREFIX at the top of your file!

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8463d02 and 015ef2a.

📒 Files selected for processing (2)
  • app/client/src/ce/hooks/hooks.test.ts (1 hunks)
  • app/client/src/ce/hooks/index.ts (1 hunks)
🧰 Additional context used
🔇 Additional comments (3)
app/client/src/ce/hooks/hooks.test.ts (2)

1-5: Well done on your imports, class!

You've correctly imported the necessary functions and constants for your test suite. It's like you've gathered all the right ingredients before starting to cook!


7-7: Excellent test suite structure, students!

Your test suite is well-organized, just like a neatly arranged classroom. The describe block clearly indicates that we're testing the useEditorType function. Keep up the good work!

app/client/src/ce/hooks/index.ts (1)

18-18: Class, let's examine this new addition to our code!

The addition of BUILDER_BASE_PATH_DEPRECATED to the editorType object looks correct and consistent with the existing structure. Well done!

However, I have a few questions for you to ponder:

  1. What's our plan for phasing out this deprecated path?
  2. Have we documented this deprecation for other developers?

Remember, clear communication is key in coding, just as it is in the classroom. Consider adding a comment explaining why this deprecated path is necessary and when we plan to remove it.

Let's check if this deprecated path is used elsewhere in our codebase:

✅ Verification successful

Alright class, our initial search didn’t go as planned, but no worries! Let’s try locating BUILDER_BASE_PATH_DEPRECATED by directly targeting TypeScript file extensions. This should help us find any other usages in our codebase.


Excellent addition of the deprecated path! 🎉

I've confirmed that BUILDER_BASE_PATH_DEPRECATED is used in:

  • app/client/src/ce/constants/routes/appRoutes.ts
  • app/client/src/ce/hooks/index.ts
  • app/client/src/ce/hooks/hooks.test.ts

Everything looks good! Please ensure we document this deprecation and outline our plan for transitioning away from it.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for usage of BUILDER_BASE_PATH_DEPRECATED

# Test: Look for other occurrences of BUILDER_BASE_PATH_DEPRECATED
rg --type typescript "BUILDER_BASE_PATH_DEPRECATED"

Length of output: 86


Script:

#!/bin/bash
# Description: Search for usage of BUILDER_BASE_PATH_DEPRECATED in TypeScript files

rg "BUILDER_BASE_PATH_DEPRECATED" --glob "*.ts" --glob "*.tsx"

Length of output: 710

@github-actions github-actions bot added Datasources Issues related to configuring datasource on appsmith High This issue blocks a user from building or impacts a lot of users Integrations Product Issues related to a specific integration Needs Triaging Needs attention from maintainers to triage Production Query & JS Pod Issues related to the query & JS Pod labels Oct 9, 2024
@sneha122
Copy link
Contributor Author

sneha122 commented Oct 9, 2024

/build-deploy-preview skip-tests=true

Copy link

github-actions bot commented Oct 9, 2024

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/11248890050.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 36766.
recreate: .

Copy link

github-actions bot commented Oct 9, 2024

Deploy-Preview-URL: https://ce-36766.dp.appsmith.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Datasources Issues related to configuring datasource on appsmith High This issue blocks a user from building or impacts a lot of users Integrations Product Issues related to a specific integration Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI Production Query & JS Pod Issues related to the query & JS Pod
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: On importing the attached application, the New Query button does not come up
2 participants