Skip to content

Load multiple files in parallel instead of sequentially #82

@tmshv

Description

@tmshv

Problem

src/store/effects/add-multiple-files.ts:4-8 loads files one by one in a for loop:

const addMultipleFiles = createAsyncThunk("addMultipleFiles", async (paths: string[], thunkAPI) => {
    for (const path of paths) {
        thunkAPI.dispatch(addFile(path))
    }
})

When dragging multiple files onto the app, each file waits for the previous one to finish. This creates a poor user experience with large file sets.

What needs to change

Dispatch all addFile thunks in parallel using Promise.all:

const addMultipleFiles = createAsyncThunk("addMultipleFiles", async (paths: string[], thunkAPI) => {
    await Promise.all(paths.map(path => thunkAPI.dispatch(addFile(path))))
})

Note: verify that SourceStorage on the Rust side handles concurrent access safely (it uses Mutex, so should be fine).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions