Skip to content

Commit 75034f7

Browse files
committed
feat: reenable settings persistence
1 parent 5e365ae commit 75034f7

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

packages/pluggableWidgets/datagrid-web/src/Datagrid.depsContainer.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,22 @@ class DatagridContainer extends Container {
246246
// Make sure essential services are created upfront
247247
this.get(TOKENS.paramsService);
248248
this.get(TOKENS.paginationService);
249+
if (this.isSettingsStorageEnabled(props)) {
250+
this.get(TOKENS.personalizationService);
251+
}
249252

250253
// Hydrate filters from props
251254
this.get(TOKENS.combinedFilter).hydrate(props.datasource.filter);
252255

253256
return this;
254257
}
255258

259+
private isSettingsStorageEnabled(props: MainGateProps): boolean {
260+
if (props.configurationStorageType === "localStorage") return true;
261+
if (props.configurationStorageType === "attribute" && props.configurationAttribute) return true;
262+
return false;
263+
}
264+
256265
setProps = (_props: MainGateProps): void => {
257266
throw new Error(`${this.id} is not initialized yet`);
258267
};

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { disposeBatch } from "@mendix/widget-plugin-mobx-kit/disposeBatch";
66

77
import { DerivedPropsGate, SetupComponent, SetupComponentHost } from "@mendix/widget-plugin-mobx-kit/main";
88

9-
import { action, autorun, computed, makeObservable, observable, trace } from "mobx";
9+
import { action, autorun, computed, makeObservable, observable } from "mobx";
1010
import { DatagridContainerProps } from "../../../typings/DatagridProps";
1111
import { ColumnId, GridColumn } from "../../typings/GridColumn";
1212
import { ColumnFilterSettings, ColumnPersonalizationSettings } from "../../typings/personalization-settings";
@@ -95,9 +95,6 @@ export class ColumnGroupStore implements IColumnGroupStore, IColumnParentStore,
9595
hydrate: action,
9696
sortInstructions: computed({ keepAlive: true })
9797
});
98-
99-
trace(this, "condWithMeta");
100-
trace(this, "sortInstructions");
10198
}
10299

103100
setup(): () => void {

packages/pluggableWidgets/datagrid-web/src/helpers/state/column/ColumnFilterStore.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ export class ColumnFilterStore implements IColumnFilterStore {
4646
makeObservable<this>(this, {
4747
condition: computed
4848
});
49-
50-
// trace(this, "condition");
5149
}
5250

5351
setup(): () => void {

0 commit comments

Comments
 (0)