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 navigateToApp behavior when openInNewTab is true #110712

Merged

Conversation

patrykkopycinski
Copy link
Contributor

@patrykkopycinski patrykkopycinski commented Aug 31, 2021

Summary

Untitled_.Sep.4.2021.1_49.AM.mp4

@patrykkopycinski patrykkopycinski added bug Fixes for quality problems that affect the customer experience v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.14.0 auto-backport Deprecated - use backport:version if exact versions are needed v7.15.0 v7.16.0 labels Aug 31, 2021
@patrykkopycinski patrykkopycinski self-assigned this Aug 31, 2021
@patrykkopycinski patrykkopycinski marked this pull request as ready for review September 3, 2021 06:54
@patrykkopycinski patrykkopycinski requested a review from a team as a code owner September 3, 2021 06:54
@patrykkopycinski
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

expected head sha didn’t match current head ref.

@mshustov
Copy link
Contributor

mshustov commented Sep 3, 2021

@patrykkopycinski Could add a link to an issue with a problem statement and steps to reproduce the problem, please?

@patrykkopycinski
Copy link
Contributor Author

@mshustov attached the recording
To reproduce this issue:

  1. Go to Cases app in the Security Solution
  2. Create a case.
  3. Add visualization to the Case comment.
  4. After the comment is saved you can click on the comment actions menu and choose Open visualization option, it should open the Lens app in the new tab and also break the breadcrumbs on the Cases tab

Comment on lines 256 to 261
if (openInNewTab) {
this.openInNewTab!(getAppUrl(availableMounters, appId, path));
} else {
this.navigate!(getAppUrl(availableMounters, appId, path), state, replace);
return;
}

this.navigate!(getAppUrl(availableMounters, appId, path), state, replace);
Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, currentAppId$ shouldn't emit when we're opening in a new tab.

this.appInternalStates.delete(this.currentAppId$.value!);

should not be triggered either and should also be skipped. Could you please also fix this?

Index: src/core/public/application/application_service.tsx
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/src/core/public/application/application_service.tsx b/src/core/public/application/application_service.tsx
--- a/src/core/public/application/application_service.tsx	(revision 501e3150111867f0a100b49daf52463d05a12069)
+++ b/src/core/public/application/application_service.tsx	(date 1625645624318)
@@ -250,16 +250,15 @@
         if (path === undefined) {
           path = applications$.value.get(appId)?.defaultPath;
         }
-        if (!navigatingToSameApp) {
-          this.appInternalStates.delete(this.currentAppId$.value!);
-        }
         if (openInNewTab) {
           this.openInNewTab!(getAppUrl(availableMounters, appId, path));
         } else {
+          if (!navigatingToSameApp) {
+            this.appInternalStates.delete(this.currentAppId$.value!);
+          }
           this.navigate!(getAppUrl(availableMounters, appId, path), state, replace);
-        }
-
-        this.currentAppId$.next(appId);
+          this.currentAppId$.next(appId);
+        }
       }
     };
 

Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

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

LGTM !!

@patrykkopycinski
Copy link
Contributor Author

@elasticmachine merge upstream

@patrykkopycinski
Copy link
Contributor Author

@elasticmachine merge upstream

@patrykkopycinski patrykkopycinski enabled auto-merge (squash) September 23, 2021 12:51
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
core 293.6KB 293.6KB +2.0B

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @patrykkopycinski

@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x
7.15

The backport PRs will be merged automatically after passing CI.

kibanamachine added a commit that referenced this pull request Sep 23, 2021
Co-authored-by: Patryk Kopyciński <patryk.kopycinski@elastic.co>
kibanamachine added a commit that referenced this pull request Sep 23, 2021
Co-authored-by: Patryk Kopyciński <patryk.kopycinski@elastic.co>
@patrykkopycinski patrykkopycinski deleted the fix/navigatetoapp-return branch September 23, 2021 17:44
lykkin pushed a commit to lykkin/kibana that referenced this pull request Sep 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes v7.15.1 v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants