From c0e4785159126d0b574e1722a3d7a0528b2753fe Mon Sep 17 00:00:00 2001 From: Deepak Kumar Date: Mon, 1 Apr 2024 16:29:08 +0530 Subject: [PATCH] Drop includeStorageKey during filter serialization, no longer needed --- src/core/filter-storage.ts | 16 ++++++---------- src/core/i-filter-storage.ts | 6 +----- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/core/filter-storage.ts b/src/core/filter-storage.ts index ebd45e000..49f8b214c 100644 --- a/src/core/filter-storage.ts +++ b/src/core/filter-storage.ts @@ -1,4 +1,4 @@ -import { IFilterListenerParams, IFilterStorage, ISerializeOpts } from './i-filter-storage.js'; +import { IFilterListenerParams, IFilterStorage } from './i-filter-storage.js'; import { IFilter } from './filters/i-filter.js'; import { filterFactory } from './filters/filter-factory.js'; import { ISerializedFilters } from './i-serialized-filters.js'; @@ -100,7 +100,7 @@ export class FilterStorage implements IFilterStorage { this.setFiltersAndNotify(storageKey, filters); } - public serialize({ includeStorageKey }: ISerializeOpts = {}): ISerializedFilters[] { + public serialize(): ISerializedFilters[] { // Include items that have active filters // In case of Composite charts, include only the parent chart return Array.from(this._listenerChains.values()) @@ -111,15 +111,11 @@ export class FilterStorage implements IFilterStorage { if (listener) { const filters = this._filters.get(listener.storageKey); if (filters && filters.length > 0) { - const entry = this._serializeFilters( - listener.dimId, - listener.dimLabel, - filters + return this._serializeFilters( + listener.dimId, + listener.dimLabel, + filters ); - if (includeStorageKey) { - entry.storageKey = listener.storageKey; - } - return entry; } } return undefined; diff --git a/src/core/i-filter-storage.ts b/src/core/i-filter-storage.ts index 23317d011..78dd55880 100644 --- a/src/core/i-filter-storage.ts +++ b/src/core/i-filter-storage.ts @@ -9,10 +9,6 @@ export interface IFilterListenerParams { applyFilters: (filters) => void; } -export interface ISerializeOpts { - includeStorageKey?: boolean; -} - export interface IFilterStorage { setFiltersFor(storageKey: any, filters); getFiltersFor(storageKey: any); @@ -20,6 +16,6 @@ export interface IFilterStorage { deRegisterFilterListener(storageKey: any, listner: any): void; notifyListeners(storageKey: any, filters): void; deRegisterAll(): void; - serialize(opts?: ISerializeOpts): ISerializedFilters[]; + serialize(): ISerializedFilters[]; restore(state: object): void; }