Skip to content

Conversation

@VineeTagarwaL-code
Copy link
Collaborator

@VineeTagarwaL-code VineeTagarwaL-code commented Jun 14, 2025

Feature: Concurrent Translation Processing + Code refactor / cleanup

Summary

This pull request introduces a significant enhancement to the translation widget by enabling concurrent processing of visible and non-visible text batches. This improvement ensures that both sets of text are translated simultaneously, allowing for more efficient and responsive updates to the user interface.

Key Changes

  • Concurrent Translation: Utilized Promise.allSettled to trigger translations for both visible and non-visible batches at the same time. This allows each batch to update the UI and cache independently upon resolution.
  • Independent UI Updates: Each batch now updates the DOM and saves translations to the cache as soon as it resolves, without waiting for the other batch to complete.
  • Delay Simulation: Introduced a 10-second delay for non-visible batch processing to simulate real-world scenarios where non-visible content might be deprioritized or processed differently.

Benefits

  • Improved Performance: By processing translations concurrently, the widget can handle large amounts of text more efficiently.
  • Responsive UI: Users experience faster updates as visible content is translated and displayed without delay.
  • Scalability: The architecture supports future enhancements and optimizations, such as prioritizing visible content or handling different types of content differently.

Testing

  • Verified that both visible and non-visible batches are processed concurrently.
  • Ensured that UI updates occur independently for each batch.
  • Confirmed that translations are correctly cached and retrieved.

@vercel
Copy link

vercel bot commented Jun 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
translation-widget ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 16, 2025 5:37pm

@VineeTagarwaL-code VineeTagarwaL-code changed the title Feat/code imp Concurrent Translation Processing + Code Refactor / Cleanup Jun 14, 2025
@VineeTagarwaL-code VineeTagarwaL-code changed the title Concurrent Translation Processing + Code Refactor / Cleanup Concurrent Translation Processing for visible and non-visible nodes + Code Refactor / Cleanup Jun 14, 2025
@VineeTagarwaL-code VineeTagarwaL-code merged commit 571b89b into main Jun 16, 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.

1 participant