Skip to content

[Bug] Possible bugs due to different instances of history in NP apps #53692

@Dosant

Description

@Dosant

Summary

While digging into new state management utils #53582 I bumped into following issue in an example np app I created. The app uses react-router.

The bug is: App's react-router doesn't trigger re-render when clicking on current app link in chrome's side nav.

Reproduction

Video: https://drive.google.com/open?id=17zj0hPR96lAeRn_ehJEMFK3kh-LkbFkP
To run the same and to see code it's: #53582

Cause

It looks like it happening, because np app navigation is happening using core's instance of history https://github.com/elastic/kibana/blob/master/src/core/public/chrome/ui/header/header.tsx#L325, and app react-router's history instance is different one, so listen cb doesn't fire for events fired by core's history and react-router can't trigger rerender.

Possible solution

  1. Expose core's history instance for apps to pass into react-router?
    This will cause complications with base path... as it is different for core and apps. Apps will have to append {appBasePath} to react-router configs ... so this is likely not an option
  2. If that use case I found is the only one: If that use case I found is the only one, then we could add additional if(appIsActive){ ... } branch here: https://github.com/elastic/kibana/blob/master/src/core/public/chrome/ui/header/header.tsx#L325and notify current app that user clicked on it's link and let app handle it?
    Or, just reload the page.

?

Metadata

Metadata

Assignees

Labels

Feature:New PlatformFeature:StateManagementTeam:CorePlatform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t//blockerbugFixes for quality problems that affect the customer experiencediscuss

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions