mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-19 19:46:42 +00:00
Fix note replies getting reset when opening a modal. Because we're iterating through the stack in app/Modal, the note prop on NoteDetail gets re-supplied when opening a child modal. This nukes replies beause we assign them to a local variable which was getting reactively overwritten. Detaching displayNote from note fixes it. This problem is likely to show up elsewhere.
This commit is contained in:
parent
fa1211a2fd
commit
1365e2643f
@ -22,32 +22,31 @@
|
|||||||
let sub = null
|
let sub = null
|
||||||
let loading = true
|
let loading = true
|
||||||
let feedRelay = null
|
let feedRelay = null
|
||||||
|
let displayNote = asDisplayEvent(note)
|
||||||
|
|
||||||
const setFeedRelay = relay => {
|
const setFeedRelay = relay => {
|
||||||
feedRelay = relay
|
feedRelay = relay
|
||||||
}
|
}
|
||||||
|
|
||||||
$: displayNote = asDisplayEvent(note)
|
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if (!note.pubkey) {
|
if (!displayNote.pubkey) {
|
||||||
await network.load({
|
await network.load({
|
||||||
relays: sampleRelays(relays),
|
relays: sampleRelays(relays),
|
||||||
filter: {kinds: [1], ids: [note.id]},
|
filter: {kinds: [1], ids: [displayNote.id]},
|
||||||
onChunk: events => {
|
onChunk: events => {
|
||||||
note = first(events)
|
displayNote = first(events)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if (note) {
|
if (displayNote) {
|
||||||
log("NoteDetail", nip19.noteEncode(note.id), note)
|
log("NoteDetail", nip19.noteEncode(displayNote.id), displayNote)
|
||||||
|
|
||||||
sub = network.streamContext({
|
sub = network.streamContext({
|
||||||
maxDepth: isMobile ? 3 : 6,
|
maxDepth: isMobile ? 3 : 6,
|
||||||
notes: [note],
|
notes: [displayNote],
|
||||||
onChunk: context => {
|
onChunk: context => {
|
||||||
note = first(network.applyContext([note], user.applyMutes(context)))
|
displayNote = first(network.applyContext([displayNote], user.applyMutes(context)))
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user