Select file and plugin, add to new plugins state

This commit is contained in:
2022-08-17 23:19:55 -04:00
parent a067f21f15
commit 2065b5fa3a
15 changed files with 398 additions and 104 deletions

View File

@@ -1,7 +1,7 @@
import { createContext } from "react";
import {
addPluginInOrder,
addParsedPluginInOrder,
decrementPending,
PluginFile,
} from "../slices/plugins";
@@ -48,7 +48,7 @@ export class WorkerPool {
resolve(worker);
} else if (typeof data !== "string") {
store.dispatch(decrementPending(1));
store.dispatch(addPluginInOrder(data));
store.dispatch(addParsedPluginInOrder(data));
// Since web assembly memory cannot be shrunk, replace worker with a fresh one to avoid slow repeated
// invocations on the same worker instance. Repeated invocations are so slow that the delay in creating a
// new worker is worth it. In practice, there are usually more workers than tasks, so the delay does not slow

View File

@@ -1,6 +1,6 @@
import { WorkerPool } from "./WorkerPool";
import store from "./store";
import { clearPlugins, setPending } from "../slices/plugins";
import { clearParsedPlugins, setPending } from "../slices/plugins";
export const excludedPlugins = [
"Skyrim.esm",
@@ -28,7 +28,7 @@ export const parsePluginFiles = (pluginFiles: File[], workerPool: WorkerPool) =>
alert("Found no plugins in the folder. Please select the Data folder underneath the Skyrim installation folder.");
return;
}
store.dispatch(clearPlugins());
store.dispatch(clearParsedPlugins());
store.dispatch(setPending(pluginFiles.length));
pluginFiles.forEach(async (plugin) => {