Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Reload and invalidate the entire form on new additions

Oliver Güntherdba1061390b3
diff --git a/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts b/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts
index 87ac83cd4ad..7942f5d6bff 100644
--- a/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts
+++ b/frontend/src/app/shared/components/fields/changeset/resource-changeset.ts
@@ -108,8 +108,8 @@ export class ResourceChangeset<T extends HalResource = HalResource> {
/**
* Returns the cached form or loads it if necessary.
*/
- public getForm():Promise<FormResource> {
- if (this.form$.isPristine() && !this.form$.hasActivePromiseRequest()) {
+ public getForm(reload = false):Promise<FormResource> {
+ if ((this.form$.isPristine() || reload) && !this.form$.hasActivePromiseRequest()) {
return this.updateForm();
}
@@ -327,13 +327,6 @@ export class ResourceChangeset<T extends HalResource = HalResource> {
return this.cache[key] = request();
}
- /**
- * Invalidate a cache value
- */
- public invalidateCache(key:string) {
- delete this.cache[key];
- }
-
protected get minimalPayload() {
return { lockVersion: this.pristineResource.lockVersion, _links: {} };
}
diff --git a/frontend/src/app/shared/components/fields/edit/field-types/select-edit-field/select-edit-field.component.ts b/frontend/src/app/shared/components/fields/edit/field-types/select-edit-field/select-edit-field.component.ts
index c9ade5bc737..fb1ed0c837e 100644
--- a/frontend/src/app/shared/components/fields/edit/field-types/select-edit-field/select-edit-field.component.ts
+++ b/frontend/src/app/shared/components/fields/edit/field-types/select-edit-field/select-edit-field.component.ts
@@ -251,9 +251,7 @@ export class SelectEditFieldComponent extends EditFieldComponent implements OnIn
return;
}
- const cacheKey = this.schema.allowedValues.$link.href;
- this.change.invalidateCache(cacheKey);
- await this.loadValues().toPromise();
+ await this.change.getForm(true);
this.onChange(value);
}