Skip to content

Commit f304552

Browse files
author
Dennis Labordus
committed
Fixed refresh problem in CoMPAS Versions Editor
Signed-off-by: Dennis Labordus <[email protected]>
1 parent d2606b2 commit f304552

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/compas-editors/CompasVersions.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { css, html, LitElement, property, TemplateResult } from 'lit-element';
1+
import {css, html, LitElement, property, PropertyValues, TemplateResult} from 'lit-element';
22
import { get, translate } from 'lit-translate';
3-
import { nothing } from 'lit-html';
43

54
import '@material/mwc-fab';
65
import '@material/mwc-icon';
@@ -44,7 +43,7 @@ export default class CompasVersionsPlugin extends LitElement {
4443
docName!: string;
4544

4645
@property()
47-
historyItem!: Element[];
46+
historyItem: Element[] | undefined;
4847

4948
firstUpdated(): void {
5049
if (!this.docId) {
@@ -54,8 +53,18 @@ export default class CompasVersionsPlugin extends LitElement {
5453
}
5554
}
5655

56+
protected updated(_changedProperties: PropertyValues): void {
57+
super.updated(_changedProperties);
58+
59+
// When the document is updated, we also will retrieve the history again, because probably it has changed.
60+
if (_changedProperties.has('doc')) {
61+
this.firstUpdated();
62+
}
63+
}
64+
5765
fetchData(): void {
5866
const type = getTypeFromDocName(this.docName);
67+
this.historyItem = undefined;
5968
CompasSclDataService().listVersions(type, this.docId)
6069
.then(xmlResponse => {
6170
this.historyItem = Array.from(xmlResponse.querySelectorAll('HistoryItem') ?? []);

0 commit comments

Comments
 (0)