Skip to content

Commit

Permalink
feat(Services): Improve performance when reordering services
Browse files Browse the repository at this point in the history
  • Loading branch information
adlk committed Mar 14, 2018
1 parent 47885bb commit 82e832c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/containers/layout/AppLayoutContainer.js
Expand Up @@ -94,7 +94,7 @@ export default class AppLayoutContainer extends Component {

const servicesContainer = (
<Services
services={services.allDisplayed}
services={services.allDisplayedUnordered}
handleIPCMessage={handleIPCMessage}
setWebviewReference={setWebviewReference}
openWindow={openWindow}
Expand Down
6 changes: 6 additions & 0 deletions src/stores/ServicesStore.js
Expand Up @@ -87,6 +87,12 @@ export default class ServicesStore extends Store {
return this.stores.settings.all.showDisabledServices ? this.all : this.enabled;
}
// This is just used to avoid unnecessary rerendering of resource-heavy webviews
@computed get allDisplayedUnordered() {
const services = this.allServicesRequest.execute().result || [];
return this.stores.settings.all.showDisabledServices ? services : services.filter(service => service.isEnabled);
}
@computed get filtered() {
return this.all.filter(service => service.name.toLowerCase().includes(this.filterNeedle.toLowerCase()));
}
Expand Down

0 comments on commit 82e832c

Please sign in to comment.