Skip to content

Commit

Permalink
fixed caching of searches
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioG70 committed Nov 8, 2024
1 parent 59f923d commit 166b5c1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,13 @@ public class DatabaseSearchPanel extends RightPanel implements ICollectionStatus
private static Map<String, DatabaseSearchPanel> instances = new HashMap<>();
private final CollectionStatus status;

public static DatabaseSearchPanel getInstance(ViewerDatabase database, CollectionStatus status) {
return DatabaseSearchPanel.getInstance(database, status, "");
}

public static DatabaseSearchPanel getInstance(ViewerDatabase database, CollectionStatus status, String search) {
return instances.computeIfAbsent(database.getUuid(), k -> new DatabaseSearchPanel(database, status, search));
String key = database.getUuid() + search;
return instances.computeIfAbsent(key, k -> new DatabaseSearchPanel(database, status, search));
}

interface DatabaseSearchPanelUiBinder extends UiBinder<Widget, DatabaseSearchPanel> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public RightPanel load(ViewerDatabase database, CollectionStatus status) {
setContent(databaseUUID, currentHistoryPath.get(0), currentHistoryPath.get(2), new RightPanelLoader() {
@Override
public RightPanel load(ViewerDatabase database, CollectionStatus status) {
return DatabaseSearchPanel.getInstance(database, status, "");
return DatabaseSearchPanel.getInstance(database, status);
}
});
} else if (currentHistoryPath.size() == 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ public RightPanel load(ViewerDatabase database, CollectionStatus status) {
new RightPanelLoader() {
@Override
public RightPanel load(ViewerDatabase database, CollectionStatus status) {
return DatabaseSearchPanel.getInstance(database, status, "");
return DatabaseSearchPanel.getInstance(database, status);
}
});
} else if (currentHistoryPath.size() == 4
Expand Down

0 comments on commit 166b5c1

Please sign in to comment.