Refreshing a viewerframe is the act of clearing the current pixel buffer and drawing the next available frame. A standard refresh (update() or render()) often invalidates the entire canvas. However, inefficient refreshes can cause judder.
Most professional image viewers let you toggle this behavior. viewerframe mode refresh top
Advanced implementations use virtual scrolling (e.g., react-window or tanstack virtual). Here, "refresh top" means resetting the virtual scroll index to 0 and discarding the cache. Refreshing a viewerframe is the act of clearing
const virtualizer = useVirtualizer( count: items.length, getScrollElement: () => frameRef.current, estimateSize: () => 50, );
const refreshTop = () => // Clear the cache setItems(newItems); // Scroll to the very first row virtualizer.scrollToIndex(0, align: 'start' ); ;Advanced implementations use virtual scrolling (e