-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Discover][Visualize] Fix visualizing a selected field in discover search #61226
[Discover][Visualize] Fix visualizing a selected field in discover search #61226
Conversation
Pinging @elastic/kibana-app (Team:KibanaApp) |
I would suggest fixing it instead inside the diff --git a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis.ts b/src/legacy/core_plugins/visualizations/public/np_ready/public/vis.ts
index 0ba936c9f6..91b6a2368f 100644
--- a/src/legacy/core_plugins/visualizations/public/np_ready/public/vis.ts
+++ b/src/legacy/core_plugins/visualizations/public/np_ready/public/vis.ts
@@ -132,8 +132,10 @@ export class Vis {
this.data.savedSearchId = state.data.savedSearchId;
}
if (state.data && state.data.aggs) {
- let configStates = state.data.aggs;
- configStates = this.initializeDefaultsFromSchemas(configStates, this.type.schemas.all || []);
+ const configStates = this.initializeDefaultsFromSchemas(
+ cloneDeep(state.data.aggs),
+ this.type.schemas.all || []
+ );
if (!this.data.indexPattern) {
if (state.data.aggs.length) {
throw new Error('trying to initialize aggs without index pattern'); |
Agree! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for fixing this so quickly! Could you add a functional test for that, the maps team recently added one for linking geo point fields to maps. Would be nice to catch this kinds of errors in the future.
describe('discover visualize button', () => { |
Good call @kertal ! I'd kindly ask @dmlemeshko to take a look at functional tests changes! 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code LGTM, tested locally in chrome, thx a lot for the functional test!
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I ran broken scripted fields
and the newly added tests against Istanbul-instrumented Kibana and both are passing. Thank you for the fix!
…arch (elastic#61226) * Fix visualize a discover search * Move deep clone into vis.ts * Add functional tests * Fix passing filters to visualize * Revert fixing filters
…arch (elastic#61226) * Fix visualize a discover search * Move deep clone into vis.ts * Add functional tests * Fix passing filters to visualize * Revert fixing filters
Summary
Fixes #61213
Fixes #61103
Data should be deep cloned since the object is freezed on mutations.
The mutation was occurred in
AggConfig.ensureIds
while creating newAggConfigs
object .Checklist
Delete any items that are not applicable to this PR.
For maintainers