prevOptions should be optional
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user