Emoji picker: keep pictures in view, ask for picker emoji at 48 px (#619) #625
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/619-picker-flicker"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Cause
Since
292a6706("Play animated emoji in the expression picker", first shipped in nightly 291), the picker plays the animated custom emoji in view. Its 40 px cells built their URLs withemoji::url, which gives the 240 px enlarged rung to anything over 24 px (widgets/emoji.rs,url). That is 225 KiB a frame, about 8.8 MiB for a 40-frame animated emoji. A section of animated emoji in view then wants several times the image store's 96 MiB (images::DEFAULT_MAX_BYTES).Images::store(crates/fluxer-ui/src/images.rs) made room for each arrival by evicting the least recently requested entries. Those were the other pictures on screen, the guild icons of the picker's rail and of the app's community rail among them. The next request pass (App::request_images, on every hover, scroll or snapshot) asked for them again, their arrival evicted others, and so it went on with no end. That explains the screenshot: random empty cells in one frame, images missing all over the app, rail icons flipping between picture and initials.Reproduction (reaction picker, community of 72 custom emoji, half animated, fake proxy answering at the URL's size with 40 frames): 156 of the 166 wanted pictures are missing on every frame and all 156 are loaded again, with the store pinned at its budget (87.9 MiB). It looks the same with the cursor still (frames come from snapshots), while hovering cells, and while scrolling.
Bisect, using the same test: nightly 290 (
c24495a) passes. 291 (bea187b), 297 (2e1825b), 304 (dc426c1) and 307 (3208c85) all fail. PR #540 (#535,wanted_animatedfor quick reactions) is not the cause: it adds at most a few 128 px URLs while a message is hovered or its menu is open, and it does not change what the picker asks for. PR #608 does not touch the picker's images.Fix
EMOJI_PICKER_CUSTOM_EMOJI_SIZE = 48,EmojiRenderer.tsx). Newemoji::url_at/emoji::view_attake the rung explicitly, and the grid's cells useemoji_grid::EMOJI_RUNG. A 40-frame animated emoji is now 360 KiB, and the same screen wants 15 MiB. The inspector is unchanged. As before, the grid animates every animated emoji when "Animate emoji" is on, which is what the original does (useShouldAnimate({kind: 'emoji'})).Images::request_all. A load can then evict only entries outside that set. If what is in view does not fit, the budget gives way and the view does not. A late load of an image that is no longer in view and does not fit is dropped.Tests
crates/fluxer-ui/tests/picker_images.rsruns the shell's request pass (media::wanted→request_all→ loads answered one frame later) over 30 frames, in three cases: still, hovering cells, scrolling. It asserts: no reloads, nothing wanted is missing, the same cells draw every frame (still and hovering), no loads at all once settled (still), and the store stays within its budget. It fails on 291, 297, 304 and 307 and passes on 290. With only the store change (rung back at 240) it still fails on the budget check.images::tests::images_in_view_are_never_evicted_and_the_rest_gives_way.tests/message_actions.rs(includinganimated_quick_reactions_play) andtests/expression_picker.rspass. Theemoji_picker*goldens are unchanged.FLUXER_SCREENSHOT_TESTS=1 cargo xtask ci: all steps passed.Not reproduced headlessly: the black band across the grid in the screenshot (it would need the GPU). It is probably a side effect of the same churn, since every reload makes new image handles to upload. The real
fluxer-platformloader was not exercised: its 64 MiB memory tier was also smaller than the set, so each reload read from disk and decoded again.Refs #619
🤖 Generated with Claude Code