Skip to content

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

Merged
Siedlerchr merged 6 commits into
JabRef:mainfrom
ZodGaz:fix-issue-13382
Jul 19, 2025
Merged

Group tab is now empty when there are no libraries open#13473
Siedlerchr merged 6 commits into
JabRef:mainfrom
ZodGaz:fix-issue-13382

Conversation

@ZodGaz

@ZodGaz ZodGaz commented Jul 5, 2025

Copy link
Copy Markdown
Contributor

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.
Comment thread jabgui/src/main/java/org/jabref/gui/frame/JabRefFrame.java
@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
Copy Markdown
Member

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

@ZodGaz

ZodGaz commented Jul 15, 2025

Copy link
Copy Markdown
Contributor Author

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.
@trag-bot

trag-bot Bot commented Jul 16, 2025

Copy link
Copy Markdown

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

@Siedlerchr Siedlerchr enabled auto-merge July 19, 2025 10:11
@Siedlerchr Siedlerchr added this pull request to the merge queue Jul 19, 2025
Merged via the queue into JabRef:main with commit fe3798c Jul 19, 2025
1 check passed
dcarpentiero pushed a commit to dcarpentiero/jabref that referenced this pull request Jul 24, 2025
* Fix issue JabRef#13382, that was probably related to the cleanup logic in GroupTreeViewModel not being triggered properly. Setting the activeDatabase to null when the last LibraryTab is closed seems to fix the issue.

* Update CHANGELOG.md

* Fix title bar DB name and an uncaught exception

- 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.

---------

Co-authored-by: Christoph <siedlerkiller@gmail.com>
Siedlerchr added a commit that referenced this pull request Aug 2, 2025
* upstream/main:
  Bump jablib/src/main/resources/csl-locales from `3bad433` to `ea1b54f` (#13565)
  New Crowdin updates (#13562)
  Add a new field for citation count (#13531)
  Automatic lookup of DOI at citation relations (#13539)
  Update dependency com.konghq:unirest-modules-gson to v4.5.0 (#13557)
  Group tab is now empty when there are no libraries open (#13473)
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