diff --git a/plugins/notification-resources/src/components/Activity.svelte b/plugins/notification-resources/src/components/Activity.svelte index ae2c193539..05e15d38fc 100644 --- a/plugins/notification-resources/src/components/Activity.svelte +++ b/plugins/notification-resources/src/components/Activity.svelte @@ -75,8 +75,6 @@ $: getFiltered(docs, filter) - $: changeSelected(selected) - function markAsRead (index: number) { if (filtered[index] !== undefined) { filtered[index].txes.forEach((p) => (p.isNew = false)) @@ -97,6 +95,7 @@ } else { selected-- } + changeSelected(selected) } else { selected = 0 _id = undefined @@ -111,6 +110,7 @@ const value = selected + offset if (filtered[value] !== undefined) { selected = value + changeSelected(selected) } } }) diff --git a/plugins/notification-resources/src/components/EmployeeInbox.svelte b/plugins/notification-resources/src/components/EmployeeInbox.svelte index 310c74e145..ec38eb14ff 100644 --- a/plugins/notification-resources/src/components/EmployeeInbox.svelte +++ b/plugins/notification-resources/src/components/EmployeeInbox.svelte @@ -76,8 +76,6 @@ } ) - $: changeSelected(selected) - function markAsRead (index: number) { if (docs[index] !== undefined) { docs[index].txes.forEach((p) => (p.isNew = false)) @@ -98,6 +96,7 @@ } else { selected-- } + changeSelected(selected) } else { selected = 0 _id = undefined @@ -112,6 +111,7 @@ const value = selected + offset if (docs[value] !== undefined) { selected = value + changeSelected(selected) } } }) @@ -152,11 +152,13 @@ key.stopPropagation() key.preventDefault() selected-- + changeSelected(selected) } if (key.code === 'ArrowDown') { key.stopPropagation() key.preventDefault() selected++ + changeSelected(selected) } if (key.code === 'Enter') { key.preventDefault() diff --git a/plugins/notification-resources/src/components/People.svelte b/plugins/notification-resources/src/components/People.svelte index 126c4042d3..767cfb8843 100644 --- a/plugins/notification-resources/src/components/People.svelte +++ b/plugins/notification-resources/src/components/People.svelte @@ -101,6 +101,7 @@ const acc = accounts.findIndex((p) => p._id === doc.txes[doc.txes.length - 1].modifiedBy) if (acc !== -1) { selected = acc + changeSelected(selected) } } } @@ -108,8 +109,6 @@ $: getFiltered(docs, filter) - $: changeSelected(selected) - function changeSelected (index: number) { if (accounts[index] === undefined) { if (accounts.length) { @@ -118,6 +117,7 @@ } else { selected-- } + changeSelected(selected) } else { selected = 0 } @@ -139,11 +139,13 @@ key.stopPropagation() key.preventDefault() selected-- + changeSelected(selected) } if (key.code === 'ArrowDown') { key.stopPropagation() key.preventDefault() selected++ + changeSelected(selected) } if (key.code === 'Enter') { key.preventDefault()