Skip to content

Commit f93550e

Browse files
committed
feat: switch data grid to new filter system
1 parent 067eaf0 commit f93550e

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

packages/pluggableWidgets/datagrid-web/src/controllers/DatasourceParamsController.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,9 @@ export class DatasourceParamsController implements ReactiveController {
140140
return `${widgetName}:[${hash}]`;
141141
}
142142

143-
static restoreMeta(filter: FilterCondition): FiltersMeta | null {
143+
static restoreMeta(filter: FilterCondition, widgetName: string): FiltersMeta | null {
144144
const hash = this.filterHash(filter);
145-
const key = this.storageKey("dataKey", hash);
145+
const key = this.storageKey(widgetName, hash);
146146
const metaJson = sessionStorage.getItem(key);
147147
if (!metaJson) {
148148
return null;
@@ -151,13 +151,13 @@ export class DatasourceParamsController implements ReactiveController {
151151
}
152152

153153
static unzipFilter(
154-
filter?: FilterCondition,
155-
widgetName = "DatasourceParamsController"
154+
filter: FilterCondition | undefined,
155+
widgetName: string
156156
): [columnFilters: Array<FilterCondition | undefined>, customFilters: Array<FilterCondition | undefined>] {
157157
if (!filter) {
158158
return [[], []];
159159
}
160-
const meta = this.restoreMeta(filter);
160+
const meta = this.restoreMeta(filter, widgetName);
161161
if (!meta) {
162162
return [[], []];
163163
}

packages/pluggableWidgets/datagrid-web/src/helpers/state/RootGridStore.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ export class RootGridStore extends BaseControllerHost {
3838
super();
3939

4040
const { props } = gate;
41-
const [columnsInitFilter, sharedInitFilter] = DatasourceParamsController.unzipFilter(props.datasource.filter);
41+
const [columnsInitFilter, sharedInitFilter] = DatasourceParamsController.unzipFilter(
42+
props.datasource.filter,
43+
props.name
44+
);
4245

4346
this.gate = gate;
4447
this.staticInfo = {

0 commit comments

Comments
 (0)