Uses array for completions to improve reactivity
Changes the `allCompletions` computed property to return an array instead of a Map. This improves reactivity in the component that uses it, as Vue can more efficiently track changes in an array. Also simplifies the pubkey extraction process.
This commit is contained in:
parent
0d19e87897
commit
e501f8f8b8
2 changed files with 6 additions and 7 deletions
|
|
@ -144,12 +144,10 @@ watch(todaysScheduledEvents, async (events) => {
|
||||||
|
|
||||||
// Watch for new completions and fetch profiles for completers
|
// Watch for new completions and fetch profiles for completers
|
||||||
watch(allCompletions, async (completions) => {
|
watch(allCompletions, async (completions) => {
|
||||||
if (completions.size > 0) {
|
if (completions.length > 0) {
|
||||||
const pubkeys = [...completions.values()].map(c => c.pubkey)
|
const pubkeys = completions.map(c => c.pubkey)
|
||||||
if (pubkeys.length > 0) {
|
|
||||||
await fetchProfiles(pubkeys)
|
await fetchProfiles(pubkeys)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}, { immediate: true })
|
}, { immediate: true })
|
||||||
|
|
||||||
// Check if we have admin pubkeys configured
|
// Check if we have admin pubkeys configured
|
||||||
|
|
|
||||||
|
|
@ -125,10 +125,11 @@ export function useScheduledEvents() {
|
||||||
})
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all completions (reactive)
|
* Get all completions (reactive) - returns array for better reactivity
|
||||||
*/
|
*/
|
||||||
const allCompletions = computed(() => {
|
const allCompletions = computed(() => {
|
||||||
return scheduledEventService?.completions ?? new Map()
|
if (!scheduledEventService?.completions) return []
|
||||||
|
return Array.from(scheduledEventService.completions.values())
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue