Skip to content

Commit

Permalink
Fix schem browser eating ram
Browse files Browse the repository at this point in the history
  • Loading branch information
sbxte committed Jan 2, 2024
1 parent 78d0af7 commit 9162fab
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions core/src/mindustry/ui/dialogs/SchematicBrowserDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ public SchematicBrowserDialog(){
buttons.button("@schematic.browser.fetch", Icon.refresh, this::fetch);
makeButtonOverlay();
readRepositories();
read();
shown(this::setup);
onResize(this::setup);
}

void setup(){
read();
search = "";

cont.top();
Expand Down Expand Up @@ -428,7 +428,12 @@ void read(){
ui.showErrorMessage(Core.bundle.format("schematic.browser.fail.parse", link, f.name()));
}
});
repositories.put(link, schems);
if (repositories.get(link) != null) {
repositories.get(link).clear();
repositories.get(link).add(schems);
} else {
repositories.put(link, schems);
}
}
}

Expand Down Expand Up @@ -474,7 +479,13 @@ void handleRepo(String link, Http.HttpResponse res){
}
});
Core.app.post(() ->{
repositories.put(link, schems);
if (repositories.get(link) != null) {
repositories.get(link).clear();
repositories.get(link).add(schems);
} else {
repositories.put(link, schems);
}

ui.schematicBrowser.fetchedRepositories += 1;
ui.showInfoFade(Core.bundle.format("schematic.browser.fetched", link), 2f);

Expand Down

0 comments on commit 9162fab

Please sign in to comment.