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.59k forks source link

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

Closed thecodacus closed 5 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