Event JSON
{
"id": "a5a95983b3144a14c5afeccc8a7fa910e1d85022ff05ab864d1a084409d90019",
"pubkey": "70122128273bdc07af9be7725fa5c4bc0fc146866bec38d44360dc4bc6cc18b9",
"created_at": 1739824191,
"kind": 1,
"tags": [
[
"e",
"7f500ee7f51b63fda17b7c058d00e19f7f22c472819e9aa57d21e31cb6968876",
"wss://nos.lol/",
"root",
"97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322"
],
[
"e",
"7f72de9be3d7e326fb74cd74f54f3ce4b768e741e8d106d4fadf235e3f91c2d2",
"wss://nostr.wine/",
"reply",
"fd208ee8c8f283780a9552896e4823cc9dc6bfd442063889577106940fd927c1"
],
[
"p",
"70122128273bdc07af9be7725fa5c4bc0fc146866bec38d44360dc4bc6cc18b9",
"wss://nostrelites.org/"
],
[
"p",
"d475ce4b3977507130f42c7f86346ef936800f3ae74d5ecf8089280cdc1923e9",
"wss://purplepag.es/"
],
[
"p",
"97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322",
"wss://relay.damus.io/",
"hodlbod"
],
[
"p",
"fd208ee8c8f283780a9552896e4823cc9dc6bfd442063889577106940fd927c1"
]
],
"content": "Taking a look at this...it's a really odd pattern, but it also doesn't surprise me that it's not working.\n\nThe `value` prop is: a) only scoped to `Component1`, and b) never passed to `Component2`. Since the `state` object on `+page.svelte` is redeclared, `value` doesn't live there, either. It looks to me like Svelte is doing the natural thing and letting `value` be destroyed with its owner (i.e., `Component1`).\n\nInterestingly, the `closure` function seems to outlive its component. As your example solution suggests, copying `value` into the closure's scope ensures `value` has the same lifespan as `closure`.\n\nHow come this worked in Svelte 4? I'm trying to understand what Svelte/JS is doing with the references under the hood that would explain the behavior.",
"sig": "b0b6cd654c03ff5b736f17389443285e306d31a5a426412a09b1c0ed97f79b4f7928dadbacec71d41bd72bdbf8d3ea36e998d06b55f133ca6703a8389ba6c3ac"
}