Push to projections manually for now

This commit is contained in:
Jon Staab 2024-05-22 09:18:35 -07:00
parent 50b2922c1e
commit 86d6f9047f
4 changed files with 13 additions and 4 deletions

View File

@ -1,5 +1,6 @@
<script lang="ts">
import {nip19} from "nostr-tools"
import {toNostrURI} from '@welshman/util'
import Popover from "src/partials/Popover.svelte"
import OverflowMenu from "src/partials/OverflowMenu.svelte"
import {
@ -91,7 +92,7 @@
const share = () =>
router
.at("qrcode")
.of(nip19.nprofileEncode({pubkey, relays: hints.FromPubkeys([pubkey]).getUrls()}))
.of(toNostrURI(nip19.nprofileEncode({pubkey, relays: hints.FromPubkeys([pubkey]).getUrls()})))
.open()
</script>

View File

@ -37,6 +37,7 @@
for (const event of newEvents) {
repository.publish(event)
projections.push(event)
}
while (projections.buffer.length > 0) {

View File

@ -61,9 +61,12 @@ import {GroupAccess, RelayMode} from "src/engine/model"
// repository, and when accepted, be propagated to projections. This avoids processing
// the same event multiple times, since repository deduplicates
storage.ready.then(() => {
repository.on("event", (event: TrustedEvent) => projections.push(event))
})
// Currently commented out because when storage gets pruned and profiles etc need to be re-loaded,
// the event isn't recognized as new by repository and so it doesn't get pushed to projections. TODO
// storage.ready.then(() => {
// repository.on("event", (event: TrustedEvent) => projections.push(event))
// })
// Unwrap gift wraps and send them back to our local relay. They'll then get pushed
// back onto projections if they haven't been seen before

View File

@ -1426,6 +1426,7 @@ export const subscribe = (request: MySubscribeRequest) => {
sub.emitter.on("event", (url: string, event: TrustedEvent) => {
repository.publish(event)
projections.push(event)
request.onEvent?.(event)
})
@ -1481,6 +1482,9 @@ export const publish = (request: PublishRequest) => {
const pub = basePublish(request)
// Add the event to projections
projections.push(request.event)
// Listen to updates and update our publish queue
if (isGiftWrap(request.event) || request.event.pubkey === pubkey.get()) {
const pubInfo = omit(["emitter", "result"], pub)