mirror of
https://github.com/grafana/grafana.git
synced 2024-11-29 20:24:18 -06:00
prevOptions should be optional
This commit is contained in:
parent
d8595e9f4e
commit
f9fb1210e9
@ -32,7 +32,7 @@ export type PanelMigrationHook<TOptions = any> = (options: Partial<TOptions>) =>
|
||||
export type PanelTypeChangedHook<TOptions = any> = (
|
||||
options: Partial<TOptions>,
|
||||
prevPluginId: string,
|
||||
prevOptions: any
|
||||
prevOptions?: any
|
||||
) => Partial<TOptions>;
|
||||
|
||||
export class ReactPanelPlugin<TOptions = any> {
|
||||
|
@ -11,13 +11,15 @@ const optionsToKeep = ['valueOptions', 'stat', 'maxValue', 'maxValue', 'threshol
|
||||
export const singleStatBaseOptionsCheck = (
|
||||
options: Partial<SingleStatBaseOptions>,
|
||||
prevPluginId: string,
|
||||
prevOptions: any
|
||||
prevOptions?: any
|
||||
) => {
|
||||
optionsToKeep.forEach(v => {
|
||||
if (prevOptions.hasOwnProperty(v)) {
|
||||
options[v] = cloneDeep(prevOptions.display);
|
||||
}
|
||||
});
|
||||
if (prevOptions) {
|
||||
optionsToKeep.forEach(v => {
|
||||
if (prevOptions.hasOwnProperty(v)) {
|
||||
options[v] = cloneDeep(prevOptions.display);
|
||||
}
|
||||
});
|
||||
}
|
||||
return options;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user