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: The case of the missing tabs #33066

Merged
merged 8 commits into from
May 8, 2024
Merged

fix: The case of the missing tabs #33066

merged 8 commits into from
May 8, 2024

Conversation

hetunandu
Copy link
Member

@hetunandu hetunandu commented Apr 30, 2024

Description

Fixes #33032
Change the data structure of the tabs to now keep account different tabs for each page instead of just one page at a time. Also removed tabs state for focus retention.

Fixes #33045
Handles removing and navigating post move of js and queries to avoid being in a bad state

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/9000257489
Commit: b39c8d7
Cypress dashboard url: Click here!

Communication

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

  • Yes
  • No

@hetunandu hetunandu added the ok-to-test Required label for CI label Apr 30, 2024
# Conflicts:
#	app/client/src/ce/sagas/JSActionSagas.ts
@hetunandu hetunandu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Apr 30, 2024
@hetunandu hetunandu changed the title Fix/tabs gone missing fix: The case of the missing tabs May 2, 2024
@github-actions github-actions bot added the Bug Something isn't working label May 2, 2024
@github-actions github-actions bot added FE Coders Pod Issues related to users writing javascript in appsmith IDE Issues related to the IDE IDE Navigation Issues/feature requests related to IDE navigation, and context switching JS Objects Issues related to JS Objects Low An issue that is neither critical nor breaks a user flow Medium Issues that frustrate users due to poor UX Needs Triaging Needs attention from maintainers to triage New Developers Pod Issues that new developers face while exploring the IDE Production UX Improvement labels May 2, 2024
@hetunandu hetunandu added ok-to-test Required label for CI and removed Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI labels May 2, 2024
@github-actions github-actions bot added the Needs Triaging Needs attention from maintainers to triage label May 2, 2024
@albinAppsmith
Copy link
Collaborator

/build-deploy-preview skip-test=true

Copy link

github-actions bot commented May 2, 2024

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

Copy link

github-actions bot commented May 2, 2024

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

albinAppsmith
albinAppsmith previously approved these changes May 6, 2024
@hetunandu hetunandu marked this pull request as ready for review May 6, 2024 13:14
Copy link
Contributor

coderabbitai bot commented May 6, 2024

Walkthrough

Walkthrough

The recent modifications focus on enhancing IDE tab management by introducing a parentId parameter across various actions and sagas. This addition aims to improve the handling and tracking of tabs in different contexts, specifically addressing issues related to tabs disappearing or not updating correctly when switching contexts or pages.

Changes

Files Affected Summary of Changes
ideActions.ts, jsActionActions.ts, pluginActionActions.ts Added parentId parameter to functions related to tab management.
AppIDE.ts, FocusElements/..., FocusRetentionSaga.ts Removed unused imports and updated variable names for clarity.
JSActionSagas.ts, ActionSagas.ts, IDESaga.tsx Enhanced sagas to handle parentId in payload for better state management.
ideReducer.ts, ideSelectors.tsx Updated reducer and selectors to handle nested structures for tabs, improving state management.

Assessment against linked issues

Objective Addressed Explanation
Tabs go missing while switching pages (#33032) -
JS Object displayed in editor even when moved to a different page (#33045) -

Possibly related issues


Recent Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 60ca8a2 and b39c8d7.
Files selected for processing (1)
  • app/client/src/reducers/uiReducers/ideReducer.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • app/client/src/reducers/uiReducers/ideReducer.ts

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.

@hetunandu hetunandu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 6, 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: 6

Comment on lines +402 to +405
export const closeQueryActionTab = (payload: {
id: string;
parentId: string;
}) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure consistent parameter naming for parentId.

-  parentId: string;
+  parentPageId: string;

The parameter parentId should be renamed to parentPageId to clarify that it refers to the ID of a page, aligning with the changes in other parts of the system where parentId is used to denote the page ID.


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 closeQueryActionTab = (payload: {
id: string;
parentId: string;
}) => {
export const closeQueryActionTab = (payload: {
id: string;
parentPageId: string;
}) => {

@@ -655,7 +656,7 @@ export function* deleteActionSaga(
});

yield put(deleteActionSuccess({ id }));
yield put(closeQueryActionTabSuccess({ id }));
yield put(closeQueryActionTabSuccess({ id, parentId: pageId }));
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure consistency in handling parentId for action tabs.

- yield put(closeQueryActionTabSuccess({ id, parentId: pageId }));
+ yield put(closeQueryActionTabSuccess({ id, parentId }));

This change ensures that the parentId passed to closeQueryActionTabSuccess is consistent with the rest of the function's logic, where parentId is directly used from the function's parameters.


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
yield put(closeQueryActionTabSuccess({ id, parentId: pageId }));
yield put(closeQueryActionTabSuccess({ id, parentId }));

Comment on lines +411 to +414
export const closeQueryActionTabSuccess = (payload: {
id: string;
parentId: string;
}) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure consistent parameter naming for parentId.

-  parentId: string;
+  parentPageId: string;

The parameter parentId should be renamed to parentPageId in the closeQueryActionTabSuccess function as well, to maintain consistency and clarity across the codebase.


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 closeQueryActionTabSuccess = (payload: {
id: string;
parentId: string;
}) => {
export const closeQueryActionTabSuccess = (payload: {
id: string;
parentPageId: string;
}) => {

Comment on lines +719 to +725
yield call(
closeActionTabSaga,
closeQueryActionTab({
id: action.payload.id,
parentId: action.payload.originalPageId,
}),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Refactor to use a dedicated saga for closing action tabs.

- yield call(
-   closeActionTabSaga,
-   closeQueryActionTab({
-     id: action.payload.id,
-     parentId: action.payload.originalPageId,
-   }),
- );
+ yield put(closeQueryActionTab({
+   id: action.payload.id,
+   parentId: action.payload.originalPageId,
+ }));

This change simplifies the flow by dispatching the closeQueryActionTab action directly, which will be handled by the saga watching for this action type. This avoids the need for an explicit call to closeActionTabSaga and aligns with Redux-Saga best practices for handling side effects.


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
yield call(
closeActionTabSaga,
closeQueryActionTab({
id: action.payload.id,
parentId: action.payload.originalPageId,
}),
);
yield put(closeQueryActionTab({
id: action.payload.id,
parentId: action.payload.originalPageId,
}));

Comment on lines +258 to +264
yield call(
closeJSActionTabSaga,
closeJSActionTab({
id: action.payload.id,
parentId: actionObject.pageId,
}),
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper handling of JS action tab closure during JS collection move.

-  closeJSActionTabSaga,
-  closeJSActionTab({
-    id: action.payload.id,
-    parentId: actionObject.pageId,
-  }),
+  closeJSActionTab({
+    id: action.payload.id,
+    parentId: action.payload.destinationPageId,
+  }),

The parentId should be updated to destinationPageId when closing the JS action tab, as the JS collection is being moved to a new page. This ensures that the tab is correctly associated with the new page.


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
yield call(
closeJSActionTabSaga,
closeJSActionTab({
id: action.payload.id,
parentId: actionObject.pageId,
}),
);
yield call(
closeJSActionTab({
id: action.payload.id,
parentId: action.payload.destinationPageId,
}),
);

@@ -326,7 +332,7 @@
},
});
yield put(deleteJSCollectionSuccess({ id }));
yield put(closeJsActionTabSuccess({ id }));
yield put(closeJsActionTabSuccess({ id, parentId: pageId }));
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure correct parentId when closing JS action tab on JS collection deletion.

-  yield put(closeJsActionTabSuccess({ id, parentId: pageId }));
+  yield put(closeJsActionTabSuccess({ id, parentId: getCurrentPageId() }));

When a JS collection is deleted, the JS action tab should be closed with the current page ID as parentId, ensuring that the tab closure is associated with the correct page context.


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
yield put(closeJsActionTabSuccess({ id, parentId: pageId }));
yield put(closeJsActionTabSuccess({ id, parentId: getCurrentPageId() }));

@hetunandu hetunandu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 7, 2024
@riodeuno
Copy link
Contributor

riodeuno commented May 8, 2024

Suggestion for major improvement: Renaming the PR to "fix: The curious case of missing tabs".

@hetunandu hetunandu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels May 8, 2024
@hetunandu hetunandu merged commit 0a58544 into release May 8, 2024
143 of 151 checks passed
@hetunandu hetunandu deleted the fix/tabs-gone-missing branch May 8, 2024 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working FE Coders Pod Issues related to users writing javascript in appsmith IDE Navigation Issues/feature requests related to IDE navigation, and context switching IDE Issues related to the IDE JS Objects Issues related to JS Objects Low An issue that is neither critical nor breaks a user flow Medium Issues that frustrate users due to poor UX 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 UX Improvement
Projects
None yet
3 participants