Skip to content

Commit

Permalink
chore: clone state when randomizing
Browse files Browse the repository at this point in the history
  • Loading branch information
markisha64 committed Sep 1, 2024
1 parent de85b3b commit 4189b0e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/gui/randomize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,21 @@ pub fn randomize() -> Element {
if !current_state.randomizing() {
state.set(Steps::Extracting);

let args = args_state.read().clone();

spawn(async move {
match &args_state.read().path {
match &args.path {
Some(path) => {
preset_state.write().randomizer.seed = match &args_state.read().seed {
Some(seed) => *seed,
preset_state.write().randomizer.seed = match args.seed {
Some(seed) => seed,
None => preset_state.read().randomizer.seed,
};

let file_name = match &args_state.read().output {
let preset = preset_state.read().clone();

let file_name = match &args.output {
Some(name) => name.clone(),
None => format!("{}", preset_state.read().randomizer.seed)
None => format!("{}", preset.randomizer.seed)
};

if !mkpsxiso::extract(path).await {
Expand All @@ -80,7 +84,7 @@ pub fn randomize() -> Element {

state.set(Steps::Randomizing);

patch(path, &preset_state.read()).await;
patch(path, &preset).await;

state.set(Steps::Packaging);

Expand Down

0 comments on commit 4189b0e

Please sign in to comment.