Browse Source

Fixes by using track by.

pull/297/head
Sebastian 8 years ago
parent
commit
95d295a20d
  1. 2
      src/Squidex/app/features/schemas/pages/schema/field.component.html
  2. 4
      src/Squidex/app/features/schemas/pages/schema/field.component.ts
  3. 2
      src/Squidex/app/features/schemas/pages/schema/schema-page.component.html
  4. 4
      src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts

2
src/Squidex/app/features/schemas/pages/schema/field.component.html

@ -106,7 +106,7 @@
<span class="nested-field-line-v"></span> <span class="nested-field-line-v"></span>
<div [sqxSortModel]="nested" (sqxSorted)="sortFields($event)" handleClass="nested"> <div [sqxSortModel]="nested" (sqxSorted)="sortFields($event)" handleClass="nested">
<div class="nested-field" *ngFor="let nested of nested"> <div class="nested-field" *ngFor="let nested of nested; trackBy: trackByField">
<span class="nested-field-line-h"></span> <span class="nested-field-line-h"></span>
<sqx-field [field]="nested" [schema]="schema" [parent]="field" [patterns]="patterns" handleClass="nested"></sqx-field> <sqx-field [field]="nested" [schema]="schema" [parent]="field" [patterns]="patterns" handleClass="nested"></sqx-field>

4
src/Squidex/app/features/schemas/pages/schema/field.component.ts

@ -111,6 +111,10 @@ export class FieldComponent implements OnInit {
this.schemasState.lockField(this.schema, this.field).onErrorResumeNext().subscribe(); this.schemasState.lockField(this.schema, this.field).onErrorResumeNext().subscribe();
} }
public trackByField(index: number, field: NestedFieldDto) {
return field.fieldId;
}
public save() { public save() {
const value = this.editForm.submit(); const value = this.editForm.submit();

2
src/Squidex/app/features/schemas/pages/schema/schema-page.component.html

@ -61,7 +61,7 @@
<ng-container *ngIf="patternsState.patterns | async; let patterns"> <ng-container *ngIf="patternsState.patterns | async; let patterns">
<div class="schemas" [sqxSortModel]="schema.fields" (sqxSorted)="sortFields($event)" handleClass="root"> <div class="schemas" [sqxSortModel]="schema.fields" (sqxSorted)="sortFields($event)" handleClass="root">
<sqx-field *ngFor="let field of schema.fields" [field]="field" [schema]="schema" [patterns]="patterns" handleClass="root"></sqx-field> <sqx-field *ngFor="let field of schema.fields; trackBy: trackByField" [field]="field" [schema]="schema" [patterns]="patterns" handleClass="root"></sqx-field>
</div> </div>
<button class="btn btn-success field-button" (click)="addFieldDialog.show()"> <button class="btn btn-success field-button" (click)="addFieldDialog.show()">

4
src/Squidex/app/features/schemas/pages/schema/schema-page.component.ts

@ -88,6 +88,10 @@ export class SchemaPageComponent implements OnDestroy, OnInit {
this.schemasState.sortFields(this.schema, fields).subscribe(); this.schemasState.sortFields(this.schema, fields).subscribe();
} }
public trackByField(index: number, field: FieldDto) {
return field.fieldId;
}
public deleteSchema() { public deleteSchema() {
this.schemasState.delete(this.schema) this.schemasState.delete(this.schema)
.subscribe(() => { .subscribe(() => {

Loading…
Cancel
Save