Skip to content

Conversation

@Glavo
Copy link
Member

@Glavo Glavo commented Jan 13, 2026

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors WorldListPage to use JavaFX's standard ListCell pattern for displaying world items, eliminating the need for custom WorldListItem and WorldListItemSkin classes.

Changes:

  • Replaced custom WorldListItem Control class with direct use of World domain objects in the list
  • Migrated UI rendering logic from WorldListItemSkin into a new WorldListCell inner class that properly implements the ListCell pattern
  • Moved world operation methods (export, delete, copy, reveal, launch, etc.) from WorldListItem to WorldListPage as they now operate directly on World objects

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
WorldListPage.java Changed generic type from WorldListItem to World, added new WorldListCell inner class implementing ListCell<World>, moved world operation methods from WorldListItem to this class, and added createListCell() override in WorldListPageSkin
WorldListItem.java Deleted - functionality moved to WorldListPage and WorldListCell
WorldListItemSkin.java Deleted - UI rendering logic moved to WorldListCell.updateItem() method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

public void delete(World world) {
WorldManageUIUtils.delete(world, () -> this.getItems().remove(world));
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The delete method removes the world from the displayed items list but does not update the worlds field. This creates an inconsistency: if the user toggles the "show all" filter or triggers a refresh, the deleted world may reappear briefly until the refresh completes. Consider also removing the world from the worlds list or calling refresh() after deletion instead of just removing from the items.

Suggested change
WorldManageUIUtils.delete(world, () -> this.getItems().remove(world));
WorldManageUIUtils.delete(world, this::refresh);

Copilot uses AI. Check for mistakes.
Task.runAsync(() -> world.install(savesDir, name))
.whenComplete(Schedulers.javafx(), () -> {
itemsProperty().add(new WorldListItem(this, new World(savesDir.resolve(name)), backupsDir, profile, id));
itemsProperty().add(new World(savesDir.resolve(name)));
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When a world is successfully installed, it's added directly to the items list but not to the worlds field. This creates inconsistency similar to the delete method: toggling filters or other operations that rely on the worlds field won't include the newly added world until a full refresh occurs. Consider calling refresh() after successful installation or updating both the worlds field and the items list.

Suggested change
itemsProperty().add(new World(savesDir.resolve(name)));
itemsProperty().add(new World(savesDir.resolve(name)));
// Ensure backing 'worlds' list and filters are updated as well
refresh();

Copilot uses AI. Check for mistakes.
Comment on lines +117 to +119
Task.supplyAsync(Schedulers.io(), () -> {
// Ensure the game version number is parsed
profile.getRepository().getGameVersion(id);
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The game version is fetched but the result is discarded. The comment says "Ensure the game version number is parsed" but it's unclear why this is necessary. If the intent is to cache the game version for later use, consider storing the result. If the parsing has side effects, consider adding a comment explaining why this call is needed.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant