refactor(network): look up LISH search detail row by id via $derived#23
Merged
libersoft-org merged 2 commits intofix/gossipsub-score-for-fresh-peersfrom May 3, 2026
Conversation
c04ddc8 to
7c43887
Compare
e218f52 to
ec99fc8
Compare
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Followup refactor to PR #22. Replaces the in-place row mutation in
lishSearch.handleUpdatewith a clean replace-by-id pattern, and moves the LISH peer-list detail page from holding a snapshot reference to looking up the row reactively by id.Why
PR #22's frontend change kept the
LishSearchResultrow identity stable across updates becauseNetwork.svelteheld a direct reference to the row object (lishPeerListRow = row). That worked but introduced two cognitive-load issues flagged in code review:What this PR does
Network.svelte— hold the LISH id, derive the row:lishSearch.svelte.ts handleUpdate— simplified back to replace-by-id:The search reducer is no longer responsible for preserving object identity — consumers that need cross-update tracking look up by id.
Edge case
When
search.clear()runs (or the row disappears from results),$derivedreturnsnulland the{:else if ... && lishPeerListRow}guard unmounts the detail page. This matches the search session lifecycle (maxnetwork.searchTimeout, default 30 s) — showing a stale frozen snapshot of a finished search would arguably be the worse UX.Dependency
Stacks on top of PR #22 (4 commits behind in this branch). Merge order: #22 first, then this. If #22 is rebased / amended, this branch needs to follow.
Test plan
bun run check(frontend) — 0 errors, 0 warnings