From ad5b2604601d133ae5c4b1b74805fbb5886ab037 Mon Sep 17 00:00:00 2001 From: huanghongxun Date: Sun, 19 Dec 2021 19:45:01 +0800 Subject: [PATCH] fix(download): cannot refresh game list. Mentioned in #1203. --- .../org/jackhuang/hmcl/ui/versions/DownloadListPage.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadListPage.java b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadListPage.java index 3e2e9d889..408559039 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadListPage.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/ui/versions/DownloadListPage.java @@ -88,6 +88,8 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP private TaskExecutor executor; protected RemoteModRepository repository; + private Runnable retrySearch; + public DownloadListPage(RemoteModRepository repository) { this(repository, null); } @@ -151,6 +153,7 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP } public void search(String userGameVersion, RemoteModRepository.Category category, int pageOffset, String searchFilter, int sort) { + retrySearch = null; setLoading(true); setFailed(false); File versionJar = StringUtils.isNotBlank(version.get().getVersion()) @@ -177,6 +180,7 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP failed.set(false); } else { failed.set(true); + retrySearch = () -> search(userGameVersion, category, pageOffset, searchFilter, sort); } }).executor(true); } @@ -360,6 +364,11 @@ public class DownloadListPage extends Control implements DecoratorPage, VersionP return null; } }, getSkinnable().failedProperty())); + spinnerPane.setOnFailedAction(e -> { + if (getSkinnable().retrySearch != null) { + getSkinnable().retrySearch.run(); + } + }); JFXListView listView = new JFXListView<>(); spinnerPane.setContent(listView);