Skip to content
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

[Canvas] Force embeddables to refresh when renderable reevaluated #67133

Merged
merged 6 commits into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,23 @@ export const EmbeddableExpressionType = 'embeddable';
export { EmbeddableTypes, EmbeddableInput };

export interface EmbeddableExpression<Input extends EmbeddableInput> {
/**
* The type of the expression result
*/
type: typeof EmbeddableExpressionType;
/**
* The input to be passed to the embeddable
*/
input: Input;
/**
* The type of embeddable
*/
embeddableType: string;
/**
* Timestamp. Needed to get a different result after each time the expression is evaluated
* to force a reload of the embeddables internal data
*/
generatedAt: number;
}

export const embeddableType = (): ExpressionTypeDefinition<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export function savedLens(): ExpressionFunctionDefinition<
disableTriggers: true,
},
embeddableType: EmbeddableTypes.lens,
generatedAt: Date.now(),
};
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export function savedMap(): ExpressionFunctionDefinition<
hiddenLayers: args.hideLayer || [],
},
embeddableType: EmbeddableTypes.map,
generatedAt: Date.now(),
};
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export function savedSearch(): ExpressionFunctionDefinition<
...buildEmbeddableFilters(filters),
},
embeddableType: EmbeddableTypes.search,
generatedAt: Date.now(),
};
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export function savedVisualization(): ExpressionFunctionDefinition<
vis: visOptions,
},
embeddableType: EmbeddableTypes.visualization,
generatedAt: Date.now(),
};
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export const embeddableRendererFactory = (core: CoreStart, plugins: StartDeps) =
});
} else {
embeddablesRegistry[uniqueId].updateInput(input);
embeddablesRegistry[uniqueId].reload();
}
},
});
Expand Down