Skip to content
Snippets Groups Projects
Unverified Commit 69048948 authored by Jack Reed's avatar Jack Reed Committed by GitHub
Browse files

Merge pull request #3039 from rwd/chore/EC-4497-memoize-annotation-resources

Memoize annotation resources
parents 4e5d5565 bd628e1e
Branches
Tags
No related merge requests found
...@@ -21,8 +21,11 @@ export default class AnnotationList { ...@@ -21,8 +21,11 @@ export default class AnnotationList {
/** */ /** */
get resources() { get resources() {
this._resources = this._resources || (() => { // eslint-disable-line no-underscore-dangle
if (!this.json || !this.json.resources) return []; if (!this.json || !this.json.resources) return [];
return flatten([this.json.resources]).map(resource => new AnnotationResource(resource)); return flatten([this.json.resources]).map(resource => new AnnotationResource(resource));
})();
return this._resources; // eslint-disable-line no-underscore-dangle
} }
} }
...@@ -24,9 +24,12 @@ export default class AnnotationPage { ...@@ -24,9 +24,12 @@ export default class AnnotationPage {
/** */ /** */
get items() { get items() {
this._items = this._items || (() => { // eslint-disable-line no-underscore-dangle
if (!this.json || !this.json.items) return []; if (!this.json || !this.json.items) return [];
return flatten([this.json.items]).map(resource => new AnnotationItem(resource)); return flatten([this.json.items]).map(resource => new AnnotationItem(resource));
})();
return this._items; // eslint-disable-line no-underscore-dangle
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment