Skip to content

Conversation

@Dosant
Copy link
Contributor

@Dosant Dosant commented Jan 29, 2020

Summary

This fixes a regression noticed by @majagrubic when working on #55443.
The regression caused by: #55158

The bug

'state:storeInSessionStorage' doesn’t take effect for dashboard without full page reload

To reproduce

  1. Go to dashboard, see the unhashed state in the url
  2. Via chrome's nav navigate to Management. Change 'state:storeInSessionStorage' setting.
  3. Navigate back to dashboard using chrome's nav. - The state hashing option didn't take effect.
    It starts working after page reload.

The fix

kbnUrlStateStorage is responsible for updating the state in the url. The problem is, that it was initialised with uiSettings('state:storeInSessionStorage') only once! Together with angular modules initialisation. -

I had to move the initialisation inside angular so each time angular app gets mounted, it creates new instance with proper value from uiSettings.

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@Dosant Dosant added v7.7.0 bug Fixes for quality problems that affect the customer experience v8.0.0 Feature:StateManagement Feature:Dashboard Dashboard related features release_note:skip Skip the PR/issue when compiling release notes labels Jan 29, 2020
@Dosant Dosant marked this pull request as ready for review January 29, 2020 14:50
@Dosant Dosant requested a review from a team January 29, 2020 14:50
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

Copy link
Contributor

@majagrubic majagrubic left a comment

Choose a reason for hiding this comment

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

Looks good!

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Code LGTM, didn't test

stateManagementConfigProvider.disable();
});

app.factory('history', () => createHashHistory());
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: It's not a big deal, but as we are trying to get away from angular we could already do that step here and call createKbnUrlStorage directly within the controller instead of letting angular handle this. Not blocking this merge, we can also tackle that later.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I needed to make sure that Listing page and Dashboard page are using the same instance of kbnUrlStateStorage.

When we clean up angular from here, these 2 just should move back somewhere to the root of the plugin and then passed down to react components.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this required? I'm asking because the dashboard listing page and the actual dashboard page are two separate apps - if you are switching between the two it is unmounting and re-mounting the application anyway (new angular context and so on). https://github.com/elastic/kibana/blob/master/src/legacy/core_plugins/kibana/public/dashboard/plugin.ts#L128

That was necessary because of the different urls - the listing page is the dashboards app, the individual dashboard is the dashboard app.

@Dosant Dosant merged commit 395e7b6 into elastic:master Jan 30, 2020
@Dosant Dosant deleted the dev/state-management/dashboard-change-dashboard-hashed-url-setting-without-page-reload branch January 30, 2020 10:09
Dosant added a commit to Dosant/kibana that referenced this pull request Jan 30, 2020
… effect for dashboard without full page reload (elastic#56284)

* bugfix: 'state:storeInSessionStorage' doesn’t take effect for dashboard without full page reload
* add test “changing 'state:storeInSessionStorage' also takes effect without full page reload”
Dosant added a commit that referenced this pull request Jan 30, 2020
… effect for dashboard without full page reload (#56284) (#56361)

* bugfix: 'state:storeInSessionStorage' doesn’t take effect for dashboard without full page reload
* add test “changing 'state:storeInSessionStorage' also takes effect without full page reload”
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Fixes for quality problems that affect the customer experience Feature:Dashboard Dashboard related features Feature:StateManagement release_note:skip Skip the PR/issue when compiling release notes v7.7.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants