Skip to content

Group tab is now empty when there are no libraries open #13473

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ZodGaz
Copy link
Contributor

@ZodGaz ZodGaz commented Jul 5, 2025

Closes #13382,

The underlying issue was that the GroupTreeViewModel listens to changes in stateManager.activeDatabaseProperty() and clears the groups only when it becomes empty. However, when the last tab was closed manually (via CloseDatabaseAction), the stateManager was not notified that there were no more open databases, so the groups were never cleared.

I initially tried addressing this from inside GroupTreeViewModel:

 private void onSelectedGroupChanged(ObservableList<GroupNodeViewModel> newValue) {
        if (!currentDatabase.equals(stateManager.activeDatabaseProperty().getValue()) && currentDatabase.isPresent()) {
            // Switch of database occurred -> do nothing
            return;
        } else if (currentDatabase.isEmpty()) {
            // All databases being closed -> clear groups
            rootGroup.setValue(null);
        }

This initially worked after also clearing groups in the closeAllDatabaseAction, but would not work with the single close database action.

To have the single action having the same behavior, I did this and it worked also for the close all action:

        if (tabbedPane.getTabs().isEmpty()) {
            stateManager.setActiveDatabase(null);
        } 

This seems to fix the bug for all the actions (so probably the statemanager was never notified when there was not active tabs), checking there's no tabs open and updating the active database triggering all the UI updates.

Feedback needed.
Also for testing purpose I did a little button in the recent tab menu to open all the recent tabs (visible in the video) , let me know if it's would be a good adding to JabRef and I will push this too.

Steps to test

Screen.Recording.2025-07-05.at.16.08.26.mov

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (if change is visible to the user)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

…c in GroupTreeViewModel not being triggered properly. Setting the activeDatabase to null when the last LibraryTab is closed seems to fix the issue.
@ZodGaz ZodGaz marked this pull request as ready for review July 7, 2025 16:56
@koppor koppor requested a review from calixtus July 7, 2025 20:56
@Siedlerchr
Copy link
Member

Groups are cleared, but the title bar still shows the last library
grafik

@ZodGaz
Copy link
Contributor Author

ZodGaz commented Jul 15, 2025

Groups are cleared, but the title bar still shows the last library

grafik

Didn't notice, will push a fix asap

ZodGaz added 2 commits July 16, 2025 14:39
- Fixed issue where the database name remained in the title bar after closing all databases.
- Fixed exception triggered by action "Close all" when the welcome tab was open.
Copy link

trag-bot bot commented Jul 16, 2025

@trag-bot didn't find any issues in the code! ✅✨

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.

Close of last library keeps group tree visible from last opened library
2 participants