Skip to content

πŸ› [Bug] QR code generation blocks the UI thread β€” causes stutter on rapid reconnectsΒ #57

@PranavAgarkar07

Description

@PranavAgarkar07

The Problem

Every time the server URL changes (new connection, IP change, sender starts), BeamSync generates a QR code. QR generation creates a 220Γ—220 PNG with error correction β€” all on the main JavaScript thread. This blocks the UI for 10-30ms per generation. πŸ“±

During network flapping (VPN switching, unstable Wi-Fi), multiple generations queue up and the UI becomes noticeably janky.

Where to Look

  • desktop/frontend/src/App.svelte β€” generateQR() at line 508. The QRCode.toDataURL() call is synchronous and CPU-intensive.
  • Consider debouncing (don't regenerate if called again within 100ms) or offloading to a microtask.

The Goal

  • QR generation should not block the UI
  • Debounce rapid URL changes so only the last one triggers a QR regen
  • Test: rapidly change the server URL 10 times β€” UI should stay responsive throughout

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions