Discover's state is getting more an more complex, syncing the appState to URL can be a huge headache when developing new features, and it's a cause for redundant re-renderings, so it can also impact performance. Furthermore, in edge case scenarios it's possible to run into "The URL for this object is too long, and we can't display it" errors. https://github.com/elastic/kibana/issues/177528
We should therefore evaluate to disable syncing appState changes to URL, aligning the behavior to Dashboard/Lens. Dashboards just takes the URL for initial syncing but every subsequent change isn't synced back, and the AppState part of the URL is removed on initial sync:
To consider:
We need to be aware that Discover is more used as a data exploration tool, than an editor, so it's more important that refresh and open a new tab works without loosing the state (Additional note, using Ad-hoc data views, then this use case is already broken)
We might consider warning the user when reloading, in case it would loose state (and we wouldn't have a way to prevent this)
So the upside of this change is
Aligning URL state behavior to Dashboards/Lens
No more problems with too long URLs
Simpler development of Discover state changes
The downsides
Copy/Paste the URL no longer works, the Share functionality has to be used (Like in other parts of Kibana)
Reload the browser tab would loose the state, but like Dashboards this could be solved by persisting the most recent state in localStorage/sessionStorage
Browser history back/forward no longer works for undoing / redoing changes
Since our Share functionality covers the generation of links, it's no regression, however, currently it takes 2 clicks to get to the link. Having a 1 click functionality would prevent this "More clicks" UX regression, one way to do this would e.g. providing a button in the breadcrumb, something @ryankeairns recently suggested:
Or a dedicated icon for this added to our top nav links?
Discover's state is getting more an more complex, syncing the appState to URL can be a huge headache when developing new features, and it's a cause for redundant re-renderings, so it can also impact performance. Furthermore, in edge case scenarios it's possible to run into "The URL for this object is too long, and we can't display it" errors. https://github.com/elastic/kibana/issues/177528
We should therefore evaluate to disable syncing appState changes to URL, aligning the behavior to Dashboard/Lens. Dashboards just takes the URL for initial syncing but every subsequent change isn't synced back, and the AppState part of the URL is removed on initial sync:
To consider:
So the upside of this change is
The downsides
Since our Share functionality covers the generation of links, it's no regression, however, currently it takes 2 clicks to get to the link. Having a 1 click functionality would prevent this "More clicks" UX regression, one way to do this would e.g. providing a button in the breadcrumb, something @ryankeairns recently suggested:
Or a dedicated icon for this added to our top nav links?
Here's some code how Dashboards is handling it:
https://github.com/elastic/kibana/blob/26389e50140be0188bee7e4fc0307c7c2688122e/src/plugins/dashboard/public/dashboard_app/url/sync_dashboard_url_state.ts#L65
https://github.com/elastic/kibana/blob/6150f76abae664856a976bc230b9e90dbd844621/src/plugins/dashboard/public/dashboard_app/dashboard_app.tsx#L182-L192