[v11.2.x] Canvas: Remove null data links (#91933)

Canvas: Remove `null` data links (#91859)

(cherry picked from commit f6b55ced6f)

Co-authored-by: Adela Almasan <88068998+adela-almasan@users.noreply.github.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-08-15 00:17:19 +03:00
committed by GitHub
co-authored by Adela Almasan
parent 59e28f82a1
commit abf09e2f7f
3 changed files with 4 additions and 2 deletions
@@ -112,7 +112,7 @@ export const DataLinksInlineEditor = ({
const key = `${link.title}/${idx}`;
const linkJSX = (
<div className={styles.itemWrapper}>
<div className={styles.itemWrapper} key={key}>
<DataLinksListItem
key={key}
index={idx}
@@ -373,6 +373,8 @@ export class ElementState implements LayerElement {
const scene = this.getScene();
const frames = scene?.data?.series;
this.options.links = this.options.links?.filter((link) => link !== null);
if (frames) {
const defaultField = {
name: 'Default field',
@@ -54,7 +54,7 @@ export const canvasMigrationHandler = (panel: PanelModel): Partial<Options> => {
// append override links to elements with dimensions mapped to same field name
for (const prop of override.properties) {
if (prop.id === 'links') {
addLinks(panel.options.root.elements, prop.value, override.matcher.options);
addLinks(panel.options.root.elements, prop.value ?? [], override.matcher.options);
} else {
props.push(prop);
}