Skip to content

Commit

Permalink
Drop includeStorageKey during filter serialization, no longer needed
Browse files Browse the repository at this point in the history
  • Loading branch information
kum-deepak committed Apr 1, 2024
1 parent 97d3156 commit c0e4785
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
16 changes: 6 additions & 10 deletions src/core/filter-storage.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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())
Expand All @@ -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;
Expand Down
6 changes: 1 addition & 5 deletions src/core/i-filter-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@ export interface IFilterListenerParams {
applyFilters: (filters) => void;
}

export interface ISerializeOpts {
includeStorageKey?: boolean;
}

export interface IFilterStorage {
setFiltersFor(storageKey: any, filters);
getFiltersFor(storageKey: any);
registerFilterListener(opts: IFilterListenerParams): any;
deRegisterFilterListener(storageKey: any, listner: any): void;
notifyListeners(storageKey: any, filters): void;
deRegisterAll(): void;
serialize(opts?: ISerializeOpts): ISerializedFilters[];
serialize(): ISerializedFilters[];
restore(state: object): void;
}

0 comments on commit c0e4785

Please sign in to comment.