Compare commits
2 commits
1a0738576a
...
be182cff3f
| Author | SHA1 | Date | |
|---|---|---|---|
| be182cff3f | |||
| ba916a4c37 |
2 changed files with 4 additions and 13 deletions
|
|
@ -32,24 +32,18 @@ export function useActivityDetail(activityId: string) {
|
||||||
isLoading.value = true
|
isLoading.value = true
|
||||||
error.value = null
|
error.value = null
|
||||||
|
|
||||||
// Scope both the subscription and the one-shot query to this
|
// Subscribe and wait for this specific event
|
||||||
// activity's d-tag. Without this scope, the query asks every
|
|
||||||
// relay for every kind-31922/31923 event and races a 5s timeout
|
|
||||||
// to find ours — on a cold page refresh that race is often lost
|
|
||||||
// even when the activity is reachable.
|
|
||||||
const detailFilters = { dTags: [activityId] }
|
|
||||||
|
|
||||||
unsubscribe = nostrService.subscribeToCalendarEvents(
|
unsubscribe = nostrService.subscribeToCalendarEvents(
|
||||||
(incoming) => {
|
(incoming) => {
|
||||||
store.upsertActivity(incoming)
|
store.upsertActivity(incoming)
|
||||||
if (incoming.id === activityId) {
|
if (incoming.id === activityId) {
|
||||||
isLoading.value = false
|
isLoading.value = false
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
detailFilters
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const results = await nostrService.queryCalendarEvents(detailFilters)
|
// Also do a one-shot query
|
||||||
|
const results = await nostrService.queryCalendarEvents()
|
||||||
store.upsertActivities(results)
|
store.upsertActivities(results)
|
||||||
|
|
||||||
// If we still don't have it after query, stop loading
|
// If we still don't have it after query, stop loading
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,6 @@ export interface CalendarEventFilters {
|
||||||
hashtags?: string[]
|
hashtags?: string[]
|
||||||
/** Filter by geohash prefix (NIP-52 'g' tag) */
|
/** Filter by geohash prefix (NIP-52 'g' tag) */
|
||||||
geohash?: string
|
geohash?: string
|
||||||
/** Filter by NIP-52 'd' tag — scopes the query to specific parameterized-replaceable events */
|
|
||||||
dTags?: string[]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -150,7 +148,6 @@ export class ActivitiesNostrService extends BaseService {
|
||||||
if (filters?.authors?.length) filter.authors = filters.authors
|
if (filters?.authors?.length) filter.authors = filters.authors
|
||||||
if (filters?.hashtags?.length) filter['#t'] = filters.hashtags
|
if (filters?.hashtags?.length) filter['#t'] = filters.hashtags
|
||||||
if (filters?.geohash) filter['#g'] = [filters.geohash]
|
if (filters?.geohash) filter['#g'] = [filters.geohash]
|
||||||
if (filters?.dTags?.length) filter['#d'] = filters.dTags
|
|
||||||
|
|
||||||
return [filter]
|
return [filter]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue