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: [IDE] Page switch and State switch have deep links to entity to avoid interim load state #32980

Merged
merged 3 commits into from
Apr 29, 2024

Conversation

hetunandu
Copy link
Member

@hetunandu hetunandu commented Apr 26, 2024

Description

Page and State switches would navigate to the last selected segment which in turn would navigate to the last selected entity in that segment. This was causing a split second delay showing the segment in a loading / blank state till the entity navigation was processed. By changing the navigation links, we will now navigate directly to the last selected entity, avoiding multiple url changes and hence renders in intermediate states

Fixes #31556

Automation

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

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/8847779176
Commit: 0cd085a
Cypress dashboard url: Click here!

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • Refactor
    • Enhanced navigation and focus elements for improved user experience.
  • New Features
    • Streamlined focus management with a new key generation function in the IDE.
  • Bug Fixes
    • Corrected issues in focus management logic for accurate page navigation and entity selection.
  • Documentation
    • Simplified focus element usage instructions and removed outdated references.

Copy link
Contributor

coderabbitai bot commented Apr 26, 2024

Walkthrough

Walkthrough

The recent updates primarily focus on refining the navigation and focus mechanisms within the AppIDE environment. This involves the removal of outdated or unused imports and functions, the introduction of new key generation functions for editor focus, and adjustments in focus handling logic. These changes aim to streamline the codebase and enhance the user experience by addressing inconsistencies in the display of queries and JavaScript objects when switching between pages.

Changes

Files Summary
AppIDE.ts, FocusSelectors.ts, FocusSetters.ts Refactored imports; removed unused imports and functions related to navigation and focus elements.
AppIDEFocusStrategy.ts (both in ce and ee directories) Introduced new functions for generating focus keys and updated existing functions to utilize these.
FocusElements.ts Renamed enum value from SelectedSegment to SelectedEntity.
hooks.ts Updated logic for focus information retrieval and page navigation; replaced and removed certain imports.

Assessment against linked issues

Objective Addressed Explanation
Address blank state issue when toggling between pages with queries/JS objects (#31556) The changes primarily focus on refactoring and do not directly address the bug related to the brief display of a blank state when toggling between pages. More investigation into state management or rendering logic might be required to resolve this issue.

The current changes do not directly address the bug specified in the linked issue (#31556). Further modifications might be necessary to specifically target and resolve the intermittent display of a blank state during page transitions.


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 95d9a19 and 0cd085a.
Files selected for processing (5)
  • app/client/src/ce/navigation/FocusElements/AppIDE.ts (2 hunks)
  • app/client/src/ce/navigation/FocusSelectors.ts (2 hunks)
  • app/client/src/ce/navigation/FocusSetters.ts (2 hunks)
  • app/client/src/pages/Editor/IDE/hooks.test.tsx (7 hunks)
  • app/client/src/pages/Editor/IDE/hooks.ts (3 hunks)
Files skipped from review as they are similar to previous changes (3)
  • app/client/src/ce/navigation/FocusElements/AppIDE.ts
  • app/client/src/pages/Editor/IDE/hooks.test.tsx
  • app/client/src/pages/Editor/IDE/hooks.ts
Additional comments not posted (3)
app/client/src/ce/navigation/FocusSelectors.ts (1)

Line range hint 3-7: The function getSelectedDatasourceId is correctly implemented and aligns with its intended purpose.

app/client/src/ce/navigation/FocusSetters.ts (2)

58-58: The implementation of setSelectedJSObject aligns well with the new navigation strategy.


63-67: The function setSelectedEntityUrl is correctly implemented and effectively supports the new navigation strategy.


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>.
    • 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 show all the console.log statements in this repository.
    • @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.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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 Bug Something isn't working IDE Navigation Issues/feature requests related to IDE navigation, and context switching Low An issue that is neither critical nor breaks a user flow Needs Triaging Needs attention from maintainers to triage New Developers Pod Issues that new developers face while exploring the IDE Production labels Apr 26, 2024
albinAppsmith
albinAppsmith previously approved these changes Apr 26, 2024
@hetunandu hetunandu added the ok-to-test Required label for CI label Apr 26, 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: 1

Comment on lines +12 to +18
export const getSelectedEntityUrl = (path: string): string | undefined => {
const ideType = getIDETypeByUrl(path);
const basePaths = getBaseUrlsForIDEType(ideType);
const entityPaths = basePaths.map((p) => `${p}/:entity*`);
const match = matchPath<{ entity: string }>(path, entityPaths);
if (match) {
return match.params.entity;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider handling the case where no URL match is found explicitly, to improve clarity and maintainability.

  if (match) {
    return match.params.entity;
  }
+ else {
+   return null; // or appropriate default value
+ }

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
export const getSelectedEntityUrl = (path: string): string | undefined => {
const ideType = getIDETypeByUrl(path);
const basePaths = getBaseUrlsForIDEType(ideType);
const entityPaths = basePaths.map((p) => `${p}/:entity*`);
const match = matchPath<{ entity: string }>(path, entityPaths);
if (match) {
return match.params.entity;
export const getSelectedEntityUrl = (path: string): string | undefined => {
const ideType = getIDETypeByUrl(path);
const basePaths = getBaseUrlsForIDEType(ideType);
const entityPaths = basePaths.map((p) => `${p}/:entity*`);
const match = matchPath<{ entity: string }>(path, entityPaths);
if (match) {
return match.params.entity;
}
else {
return null; // or appropriate default value
}

@hetunandu hetunandu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Apr 26, 2024
@hetunandu hetunandu enabled auto-merge (squash) April 29, 2024 04:07
@hetunandu hetunandu merged commit e9966ce into release Apr 29, 2024
82 checks passed
@hetunandu hetunandu deleted the fix/segment-loading-state branch April 29, 2024 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working IDE Navigation Issues/feature requests related to IDE navigation, and context switching Low An issue that is neither critical nor breaks a user flow Needs Triaging Needs attention from maintainers to triage New Developers Pod Issues that new developers face while exploring the IDE ok-to-test Required label for CI Production
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Blank state seen when toggling between pages even when it has queries/JS objects
2 participants