From 595cb9cda5767993d3c792a2efeb581101456ddf Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 23 Dec 2019 17:59:15 -0800 Subject: [PATCH] fixes: Document menu on search results is empty if not previously loaded closes #1124 --- app/stores/DocumentsStore.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/stores/DocumentsStore.js b/app/stores/DocumentsStore.js index 81e33d65f..a77c7d41d 100644 --- a/app/stores/DocumentsStore.js +++ b/app/stores/DocumentsStore.js @@ -293,15 +293,15 @@ export default class DocumentsStore extends BaseStore { query, }); invariant(res && res.data, 'Search response should be available'); - const { data } = res; - // add the document to the store - data.forEach(result => this.add(result.document)); + // add the documents and associated policies to the store + res.data.forEach(result => this.add(result.document)); + this.addPolicies(res.policies); // store a reference to the document model in the search cache instead // of the original result from the API. const results: SearchResult[] = compact( - data.map(result => { + res.data.map(result => { const document = this.data.get(result.document.id); if (!document) return null;