kevmodrome on Nostr: It should re-render if naddr changes but it can depend on how you've used it inside ...
It should re-render if naddr changes but it can depend on how you've used it inside List. It sounds like you might be making a mistake inside the List component. Here's an example I whipped up real quick:
https://svelte.dev/repl/8f554eb6d505436f85c27203021ae1b3?version=4.0.5If you look at List.svelte you'll notice that I've got two different ways of getting notes. One using the { notes } = naddr syntax and the other using the reactivity $: syntax. The reason the first one doesn't work is because *the script tag only runs once* when the component is mounted. Then it never runs again. Key works because it completely destroys the component and re-mounts it. Hopefully that sheds some clarity on the situation :)
If you can link me some code I can probably take a closer look 🤘
Published at
2023-07-12 15:42:26Event JSON
{
"id": "7e38c4fa113a16bf0873dda780dd9419016bec55bcf3212c66028b3163c03f29",
"pubkey": "7e9c924ae5255c95a454d28ae89552a1e081f828ad4dc0381508b509188c865e",
"created_at": 1689176546,
"kind": 1,
"tags": [
[
"e",
"a0890e16302aeb018feccf36fb1b4f7396b6489c25dc5865ceadf1e2e5408b3d",
"",
"root"
],
[
"e",
"18ad5ca194257bae4a1b4a7d055c1f6a87b09d4c3b1c025e7a50637d15909ffb",
"",
"reply"
],
[
"p",
"7e9c924ae5255c95a454d28ae89552a1e081f828ad4dc0381508b509188c865e"
],
[
"p",
"fa984bd7dbb282f07e16e7ae87b26a2a7b9b90b7246a44771f0cf5ae58018f52"
]
],
"content": "It should re-render if naddr changes but it can depend on how you've used it inside List. It sounds like you might be making a mistake inside the List component. Here's an example I whipped up real quick: https://svelte.dev/repl/8f554eb6d505436f85c27203021ae1b3?version=4.0.5\n\nIf you look at List.svelte you'll notice that I've got two different ways of getting notes. One using the { notes } = naddr syntax and the other using the reactivity $: syntax. The reason the first one doesn't work is because *the script tag only runs once* when the component is mounted. Then it never runs again. Key works because it completely destroys the component and re-mounts it. Hopefully that sheds some clarity on the situation :)\n\nIf you can link me some code I can probably take a closer look 🤘",
"sig": "945b162a836a097b8ae61a9b356b0bf5dda24dec8037dce5e3616075eaad4be0dcb64d1fe199f867a546e228233c436971e0311d06c01cb8f90808f1ef07e939"
}