Skip to content
This repository has been archived by the owner on Oct 23, 2023. It is now read-only.

Commit

Permalink
fix: prevent flickering of variable select
Browse files Browse the repository at this point in the history
  • Loading branch information
marionebl committed Sep 10, 2018
1 parent 4798a18 commit ad69cd0
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/model/user-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ export class UserStore {
});
}

(init.properties || [])
.filter(prop => prop.getType() !== Types.UserStorePropertyType.Page)
.forEach(prop => this.addProperty(prop));
(init.properties || []).forEach(prop => this.addProperty(prop));

const actions = init.actions || [];

Expand Down Expand Up @@ -104,6 +102,10 @@ export class UserStore {

@Mobx.action
public addProperty(property: UserStoreProperty): void {
if (property.getType() === Types.UserStorePropertyType.Page) {
return;
}

this.properties.set(property.getId(), property);
}

Expand Down Expand Up @@ -131,7 +133,12 @@ export class UserStore {
}

public getProperties(): UserStoreProperty[] {
return [this.currentPageProperty, ...this.properties.values()];
const props = [...this.properties.values()];

return [
this.currentPageProperty,
...props.filter(p => p.getType() !== Types.UserStorePropertyType.Page)
];
}

public getPropertyById(id: string): UserStoreProperty | undefined {
Expand Down

0 comments on commit ad69cd0

Please sign in to comment.