Skip to content

Comments

feat: Added asynchronous algorithm apply#20

Merged
AdamMytnik merged 5 commits intomainfrom
@mytnika/make-rust-calls-asyncronous
Jun 15, 2025
Merged

feat: Added asynchronous algorithm apply#20
AdamMytnik merged 5 commits intomainfrom
@mytnika/make-rust-calls-asyncronous

Conversation

@AdamMytnik
Copy link
Collaborator

Non-Blocking Image Processing with Live Progress Updates

Issue Fixed

Closes #16: Make rust calls asynchronous

Problem

Previously, applying multiple image processing algorithms would block the UI thread, causing the application to become unresponsive during processing. This was due to synchronous WASM function calls running consecutively without yielding control back to the main thread.

Implementation

Backend Changes

  • Individual WASM algorithm calls remain synchronous
  • Processing loop is now asynchronous, allowing UI updates between algorithms
  • Added yield points using setTimeout to prevent UI blocking

Frontend Improvements

  • Added progress visualization:
    • Progress bar showing completion percentage
    • Current algorithm name display
    • Real-time preview updates after each algorithm
  • Improved memory management with proper cleanup of image resources
  • Disabled controls during processing to prevent concurrent operations

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR converts the image processing loop to run asynchronously, adds live progress tracking in the UI, and ensures proper cleanup of created Blob URLs to avoid memory leaks.

  • Introduce async handleRun with setTimeout yields to keep the UI responsive
  • Add state and UI for progress bar, current algorithm label, and disable controls during processing
  • Manage and revoke Blob URLs for both source and result images on updates and unmount

AdamMytnik and others added 4 commits June 14, 2025 22:52
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@AdamMytnik AdamMytnik merged commit 193d2e6 into main Jun 15, 2025
2 checks passed
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.

Make rust calls asynchronous

2 participants