prs on Nostr: fix: npub search fails on the first try (#1100) This PR fixes the issue where npub ...
fix: npub search fails on the first try (#1100)
This PR fixes the issue where npub search fails on the first try.
What was happening:
`SearchEventView` calls `find_event(state:evid:search_type:find_from:callback:)` to search for the entered npub. The search actually succeeded, but the call site was ignoring the returned event and never caching the profile. The reason it works the second time is because the `RelayPool` eventually got around to caching the profile. This is also why the other PR related to this issue works by adding a short delay.
How it's fixed:
Now `SearchingEventView` will call `process_metadata_event(events:our_pubkey:profiles:ev:)`, and upon completion, will update the view state with the successful result.
fix-npub-search, 1 commits
https://github.com/damus-io/damus/pull/1100Published at
2023-05-06 03:11:42Event JSON
{
"id": "70a6ba32ecf6cb721f3c194ed4ebd27063f852b920f0757c23884946f2a3f4cc",
"pubkey": "edf16b1dd61eab353a83af470cc13557029bff6827b4cb9b7fc9bdb632a2b8e6",
"created_at": 1683342702,
"kind": 1,
"tags": [
[
"p",
"32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"
],
[
"t",
"damuspr"
]
],
"content": "fix: npub search fails on the first try (#1100)\n\nThis PR fixes the issue where npub search fails on the first try.\r\n\r\nWhat was happening:\r\n`SearchEventView` calls `find_event(state:evid:search_type:find_from:callback:)` to search for the entered npub. The search actually succeeded, but the call site was ignoring the returned event and never caching the profile. The reason it works the second time is because the `RelayPool` eventually got around to caching the profile. This is also why the other PR related to this issue works by adding a short delay.\r\n\r\nHow it's fixed:\r\nNow `SearchingEventView` will call `process_metadata_event(events:our_pubkey:profiles:ev:)`, and upon completion, will update the view state with the successful result.\n\nfix-npub-search, 1 commits\n\nhttps://github.com/damus-io/damus/pull/1100",
"sig": "9f332a3af0dc5809ead681e21759e3620dbb9b6e1c284e389b0beba113b2c6fd674fc0b8820cecb711cd5cef34947a34d66032e9ec33c8515330fe046a72cbc8"
}