Skip to content

Commit b1fd35f

Browse files
author
Dennis Labordus
authored
Merge pull request #165 from com-pas/fix-editor
Fixed refresh problem in CoMPAS Versions Editor
2 parents d2606b2 + 290c35e commit b1fd35f

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

.github/workflows/build-project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
build:
1313
name: Build
1414
runs-on: ubuntu-latest
15-
timeout-minutes: 15
15+
timeout-minutes: 30
1616

1717
steps:
1818
- name: Checkout

.github/workflows/release-project.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
1212
push_to_registry:
1313
name: Build and publish
1414
runs-on: ubuntu-latest
15+
timeout-minutes: 30
16+
1517
steps:
1618
- name: Checkout
1719
uses: actions/checkout@v3

src/compas-editors/CompasVersions.ts

Lines changed: 13 additions & 8 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,18 +43,24 @@ export default class CompasVersionsPlugin extends LitElement {
4443
docName!: string;
4544

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

49-
firstUpdated(): void {
50-
if (!this.docId) {
51-
this.historyItem = [];
52-
} else {
53-
this.fetchData()
48+
protected updated(_changedProperties: PropertyValues): void {
49+
super.updated(_changedProperties);
50+
51+
// When the document is updated, we also will retrieve the history again, because probably it has changed.
52+
if (_changedProperties.has('doc')) {
53+
if (!this.docId) {
54+
this.historyItem = [];
55+
} else {
56+
this.fetchData()
57+
}
5458
}
5559
}
5660

5761
fetchData(): void {
5862
const type = getTypeFromDocName(this.docName);
63+
this.historyItem = undefined;
5964
CompasSclDataService().listVersions(type, this.docId)
6065
.then(xmlResponse => {
6166
this.historyItem = Array.from(xmlResponse.querySelectorAll('HistoryItem') ?? []);

0 commit comments

Comments
 (0)