From 48505b6002541eeeb5aa1759885ad6d6bb2eb2ce Mon Sep 17 00:00:00 2001 From: Jeffrey Biles Date: Tue, 17 Mar 2020 22:44:50 -0700 Subject: [PATCH] Two refactors: one to make it reactive, the other to make it work The one that made it work was storing `ids` outside of the useEmailSelection function. That makes it shared between the multiple uses of the useEmailSelection function. --- src/components/InboxScreen.vue | 8 ++++---- src/components/MailTable.vue | 10 ++++++---- src/composition/useEmailSelection.js | 22 ++++++++++++---------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/components/InboxScreen.vue b/src/components/InboxScreen.vue index 7579db3..2316f9d 100644 --- a/src/components/InboxScreen.vue +++ b/src/components/InboxScreen.vue @@ -1,7 +1,7 @@ @@ -15,9 +15,9 @@ let response = await fetch('/api/emails'); let {emails} = await response.json(); - let {selectedEmailIds} = useEmailSelection(); + let {emailSelection} = useEmailSelection(); - return {emails, selectedEmailIds} + return {emails, emailSelection} }, components: { MailTable diff --git a/src/components/MailTable.vue b/src/components/MailTable.vue index 55bc196..fe068b0 100644 --- a/src/components/MailTable.vue +++ b/src/components/MailTable.vue @@ -1,11 +1,13 @@