Commit f9fb1210 by ryan

prevOptions should be optional

parent d8595e9f
......@@ -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;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment