Skip to content

Fix image flickering from ResizeObserver/virtualization feedback loop - #63

Merged
Avni2000 merged 2 commits into
mainfrom
copilot/fix-image-rendering-issues
Feb 10, 2026
Merged

Avni2000 merged 2 commits into
mainfrom
copilot/fix-image-rendering-issues

Conversation

Copilot AI commented Feb 10, 2026 •

Copy link
Copy Markdown
Contributor

Images in cell outputs were flickering rapidly, causing UI stutter. Root cause: conditional rendering swapped images with 30px placeholders based on isVisible, triggering ResizeObserver → height recalculation → visibility toggle → infinite loop.

Changes

CellOutputs always renders actual content

  • Removed placeholder rendering when !isVisible
  • Use CSS opacity: 0.3 instead for off-screen cells
  • Maintains stable row heights for virtualization

ResizeObserver debouncing and threshold

  • 150ms debounce batches rapid updates during image loading
  • 5px threshold filters noise from minor rendering variations
  • Prevents cascade effects from dynamic content
// Before: conditional rendering caused height oscillation
if (!isVisible && outputs.length > 0) {
    return <div style={{ minHeight: '30px' }}>...</div>;
}
return <div>{outputs.map(...)}</div>;

// After: stable heights with opacity optimization
return (
    <div style={{ opacity: isVisible ? 1 : 0.3 }}>
        {outputs.map(...)}
    </div>
);

The virtualization system's "content windowing" approach now works correctly—all DOM nodes remain in flow, but complexity toggles via opacity rather than conditional rendering.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • update.code.visualstudio.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node out/tests/runIntegrationTest.js --test takeAll_base (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Can you investigate why image rendering is not stable? An image (which exists, ie. filepath valid or doesn't exist - invalid render) just renders in and out contantly, which makes #file:ConflictResolver.tsx stutter. Carefully read through this problem and come up with a solution. Then, execute that solution.

I think that perhaps this has something to do with upgrading dependencies or with the history panel/draggable rows implementation we just added.

The user has attached the following file paths as relevant context:

  • src/web/client/ConflictResolver.tsx
  • AGENTS.md

Created from VS Code.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

- Always render images/outputs instead of placeholders to prevent height changes
- Add debouncing (150ms) to ResizeObserver to prevent rapid state updates
- Add height change threshold (5px) to ignore minor fluctuations
- Use CSS opacity instead of conditional rendering for performance

Co-authored-by: Avni2000 <[email protected]>
Copilot AI changed the title [WIP] Investigate and fix image rendering stability Fix image flickering from ResizeObserver/virtualization feedback loop Feb 10, 2026
Copilot AI requested a review from Avni2000 February 10, 2026 15:22
@Avni2000
Avni2000 marked this pull request as ready for review February 10, 2026 15:30
@Avni2000
Avni2000 merged commit fa3e9eb into main Feb 10, 2026
1 check passed
@Avni2000
Avni2000 deleted the copilot/fix-image-rendering-issues branch March 1, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants