Repository navigation
fix(nomadnet): load images that arrive via partial refresh - #99
torlando-tech wants to merge 1 commit into
Conversation
The image loader was configured only on full page load, so images inside a dynamic (partial) region never fetched: the compact-page merge added their records, but the loader never knew. Physical test on the cycling partial page showed region images stuck as alt-text placeholders while the official client rendered them (its image updater rescans page images after every partial update). Add ImageLoader::reconfigure: rebuild the entry list from the merged page, keyed by (image_index, cache_key). Unchanged (index,url) pairs keep their state verbatim (LOADED stays loaded, no refetch); replaced urls at the same index are re-admitted fresh; new indices are admitted under the policy gate; dropped indices are removed. An in-flight REQUESTING entry whose record was replaced in flight is reported orphaned so the caller releases the outstanding receipt before the next request. UIManager::nomad_reconfigure_images_after_partial mirrors the full-page configure (policy/loopback/RTT/EDR), runs after a fragment is applied, and releases an orphaned in-flight request (seal-then-release ordering). Manual policy: new region images wait for the user trigger; loaded ones stay loaded. Tests: six reconfigure scenarios (shrink, grow, in-place replace, in-flight orphan, in-flight preserved, manual, never). Co-Authored-By: Hermes <noreply@nousresearch.com>
|
| if (prior && prior->data.cache_key == entry.cache_key) { | ||
| // Same image at the same index: preserve state verbatim. | ||
| next.data = std::move(entry); | ||
| next.state = prior->state; | ||
| next.terminal_failure = prior->terminal_failure; |
There was a problem hiding this comment.
Loaded images lose their pixels When a partial refresh adds an image after four images are already displayed, storing the new image evicts one of the screen’s four decoded pixel slots. This branch still preserves the evicted image’s
LOADED state, so the loader never fetches it again and the unchanged part of the page shows a placeholder. The loader needs to account for decoded-slot eviction when preserving loaded state.
Knowledge Base Used: NomadNet browser
Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/tdeck_ui/UI/LXMF/NomadNetImageLoader.cpp
Line: 121-125
Comment:
**Loaded images lose their pixels** When a partial refresh adds an image after four images are already displayed, storing the new image evicts one of the screen’s four decoded pixel slots. This branch still preserves the evicted image’s `LOADED` state, so the loader never fetches it again and the unchanged part of the page shows a placeholder. The loader needs to account for decoded-slot eviction when preserving loaded state.
**Knowledge Base Used:** [NomadNet browser](https://app.greptile.com/torlando-tech/-/custom-context/knowledge-base/torlando-tech/pyxis/-/docs/nomadnet-browser.md)
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| } catch (const std::bad_alloc&) { | ||
| // Leave the previous configuration intact on allocation failure: | ||
| // the page keeps whatever loader state it had (best-effort). | ||
| return false; |
There was a problem hiding this comment.
Allocation failure strands image requests If allocation fails while rebuilding the entries, this returns
false and retains the old loader state. The caller treats false as an orphaned request and releases its receipt, even if the in-flight image is unchanged. That entry remains REQUESTING without a request, so later polls will not fetch it or advance past it. Allocation failure needs a result distinct from an orphaned request, or the retained entry must be reconciled when its receipt is released.
Prompt To Fix With AI
This is a comment left during a code review.
Path: lib/tdeck_ui/UI/LXMF/NomadNetImageLoader.cpp
Line: 169-172
Comment:
**Allocation failure strands image requests** If allocation fails while rebuilding the entries, this returns `false` and retains the old loader state. The caller treats `false` as an orphaned request and releases its receipt, even if the in-flight image is unchanged. That entry remains `REQUESTING` without a request, so later polls will not fetch it or advance past it. Allocation failure needs a result distinct from an orphaned request, or the retained entry must be reconciled when its receipt is released.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Follow-up to #98 (merged). Physical testing of the inline-images feature on a cycling partial-region page found that images inside a dynamic (partial) region never load in Pyxis: the compact-page merge adds their records, but the image loader was configured only on full page load, so region images stay alt-text placeholders forever. The official NomadNet client renders them because its image updater rescans page images after every partial update.
Fix:
ImageLoader::reconfigurerebuilds the entry list from the merged page, keyed by (image_index, cache_key):UIManager::nomad_reconfigure_images_after_partialmirrors the full-page configure (policy/loopback/RTT/EDR), runs after each applied fragment, and surfaces manual-mode pending state.Verification: 6 new loader scenarios (shrink / grow / in-place replace / in-flight orphan / in-flight preserved / manual / never); native suite 311 passed; tdeck + tdeck-release build; release audit pass (pins unchanged); x86 real-peer flow 11/11.