[Lens] Infinite reference accumulation #245317
Open
+200
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Fixes issue where Lens panels on a dashboard that have no references, like a vis with ad-hoc dataview (i.e. ES|QL), will blindly add dashboard references. But these references are not always panel-specific thus lens will absorb all dashboard references.
Details
In #239029 we moved the lens
referencesto the server and passed them in the SO underattributes.referencesuntil the references can be properly injected into the state itself.Previously we were filtering the panel
referencesfrom the dashboard with the references fromattributes.references. But with the transforms now being run on the client side code, the dashboardreferencescan be empty, see #239029 (comment). Thus we need to merge these two reference sources.kibana/x-pack/platform/plugins/shared/lens/common/embeddable_factory/index.ts
Lines 31 to 46 in b8f3c71
But additionally, the dashboard may pass the
transformOutmethod all the unfiltered rawreferenceswhen the filter references are empty.kibana/src/platform/plugins/shared/dashboard/server/api/transforms/out/transform_panels_out.ts
Line 36 in 440e3d5
The solution is to treat the lens
attributes.referencesas the source of truth and only use the dashboard references to update theidon matching references bynameandtype.fixes #245283
Checklist
release_note:breakinglabel should be applied in these situations.release_note:*label is applied per the guidelinesbackport:*labels.