Move serverConfig from property to state
Release-Notes: skip
Change-Id: I82a225c7d497e3e116c6be7157da9479c517de48
diff --git a/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.ts b/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.ts
index d4dff53d..42826c7 100644
--- a/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.ts
+++ b/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.ts
@@ -7,13 +7,16 @@
import {ServerInfo} from '../../../types/common';
import {getAppContext} from '../../../services/app-context';
import {LitElement, css, html} from 'lit';
-import {customElement, property} from 'lit/decorators';
+import {customElement, property, state} from 'lit/decorators';
import {sharedStyles} from '../../../styles/shared-styles';
import {formStyles} from '../../../styles/gr-form-styles';
import {PropertyValues} from 'lit';
import {fire} from '../../../utils/event-util';
import {ValueChangedEvent} from '../../../types/events';
import {ColumnNames} from '../../../constants/constants';
+import {subscribe} from '../../lit/subscription-controller';
+import {resolve} from '../../../models/dependency';
+import {configModelToken} from '../../../models/config/config-model';
@customElement('gr-change-table-editor')
export class GrChangeTableEditor extends LitElement {
@@ -23,14 +26,16 @@
@property({type: Boolean})
showNumber?: boolean;
- @property({type: Object})
- serverConfig?: ServerInfo;
-
@property({type: Array})
defaultColumns: string[] = [];
+ @state()
+ serverConfig?: ServerInfo;
+
private readonly flagsService = getAppContext().flagsService;
+ private readonly getConfigModel = resolve(this, configModelToken);
+
static override styles = [
sharedStyles,
formStyles,
@@ -54,6 +59,17 @@
`,
];
+ constructor() {
+ super();
+ subscribe(
+ this,
+ () => this.getConfigModel().serverConfig$,
+ config => {
+ this.serverConfig = config;
+ }
+ );
+ }
+
override render() {
return html`<div class="gr-form-styles">
<table id="changeCols">