coleam00 / bolt.new-any-llm

Prompt, run, edit, and deploy full-stack web applications using any LLM you want!
https://bolt.new
MIT License
3.89k stars 1.6k forks source link

fix(project-reload): execution order is fix, this fixes the inconsistency on project reload #309

Closed thecodacus closed 2 days ago

thecodacus commented 5 days ago

Fix Action Execution Order and Command Synchronization

Overview

This PR implements a global execution queue to ensure proper synchronization of file operations and shell commands, particularly during project reloads and code streaming. It addresses issues with command execution order and eliminates UI flickering during code streaming operations.

Key Changes

1. Global Execution Queue

2. Action Runner Updates

3. Workbench Store Improvements

Technical Details

The core improvement revolves around the introduction of a Promise-based execution queue:

#globalExecutionQueue = Promise.resolve();

addToExecutionQueue(callback: () => Promise<void>) {
  this.#globalExecutionQueue = this.#globalExecutionQueue.then(() => callback());
}

This ensures that:

Benefits

  1. Consistent command execution order during project reloads
  2. Eliminated UI flickering during code streaming
  3. More reliable file system synchronization
  4. Better handling of rapid sequential operations

Testing

Migration Impact

Preview

https://github.com/user-attachments/assets/5a55f39a-1564-452a-81e7-f8d7761a37a1

frogman544 commented 3 days ago

Great job! This is a huge win! Why is this not merged yet? What are we waiting for?

chrismahoney commented 2 days ago

I'm reviewing this right now, if it works like I think it does it is extremely important.

chrismahoney commented 2 days ago

πŸ‘ This is great. The glory is all yours, merge away. πŸ‘

thecodacus commented 2 days ago

done !! πŸ₯³