Skip to content

Fix: Refresh groupTree after removing group (fixes #11487)#12815

Merged
Siedlerchr merged 4 commits into
JabRef:mainfrom
almada39:fix-for-issue-11487
Mar 25, 2025
Merged

Fix: Refresh groupTree after removing group (fixes #11487)#12815
Siedlerchr merged 4 commits into
JabRef:mainfrom
almada39:fix-for-issue-11487

Conversation

@almada39

@almada39 almada39 commented Mar 24, 2025

Copy link
Copy Markdown
Contributor

Closes #11487

Problem:
Previously, when a group was removed, it would still appear on hover, and users could interact with it via the right-click context menu. Additionally, for groups without a description, the description of the previously removed group could incorrectly appear due to this bug. This was caused by the UI not refreshing immediately after the group was deleted. (before_changes.mp4)

before_changes.mp4

Solution:
Added groupTree.refresh(); after group removal to ensure the interface updates correctly, preventing ghost groups from lingering in the UI and avoiding incorrect description display for newly created groups. (after_changes.mp4)

after_changes.mp4

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.

@ThiloteE

ThiloteE commented Mar 24, 2025

Copy link
Copy Markdown
Member

Does this also coincidentally fix #8012 ?

@almada39

almada39 commented Mar 24, 2025

Copy link
Copy Markdown
Contributor Author

Does this also coincidentally fix #8012 ?

I don't think so, but the problem may be solved in a similar way, because only the edit command had a groupTree.refresh(); after.
I only added in the remove commands to fix this issue because I wasn't sure if it the other ones needed it.

EDIT:
While I was answering this, somehow it appeared that I had closed the merge request. If I can have some guidance on how to proceed I would really appreciate it.

@almada39 almada39 closed this Mar 24, 2025
@subhramit subhramit reopened this Mar 24, 2025
@subhramit

Copy link
Copy Markdown
Member

@almada39 There is an option to "reopen" pull requests at the same place where you closed it from. I reopened it.

case GROUP_REMOVE -> {
viewModel.removeGroupNoSubgroups(group);
case GROUP_REMOVE_KEEP_SUBGROUPS ->
groupTree.refresh();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The refresh() call is duplicated across multiple case blocks. This violates DRY principle and should be moved after the switch statement to avoid code duplication.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

BTW, what if you really add groupTree.refresh() every time there is an action?

Will that introduce more issues? I think it shouldn't.

Performance problems? I think no.

@almada39 almada39 Mar 25, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think it would be a huge problem either, I didn't do it before because i thought it wasn't there because of performance problems. This said would you like me to make a new commit with all the commands refreshing the groupTree after executing?
In that case should I also add the change in the changelog file? I didn't do it because I wasn't sure if the small change in the code was enough to write it in the file.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In case all things will do a referewsh, please collect it at the end.

Regarding CHANGELOG.md: Independent of the amount of statements needed to fix something, it should be listed there; because the behavior of JabRef changed.

@jabref-machine

Copy link
Copy Markdown
Collaborator

Note that your PR will not be accepted/reviewed until you have gone through the mandatory checks in the description and mark them as one of [x] done, [ ] not done (yet), [/] not applicable.

InAnYan
InAnYan previously approved these changes Mar 25, 2025

@InAnYan InAnYan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems to work!

@subhramit

Copy link
Copy Markdown
Member

@almada39 Please add a changelog entry.

@jabref-machine

Copy link
Copy Markdown
Collaborator

Your pull request conflicts with the target branch.

Please merge upstream/main with your code. For a step-by-step guide to resolve merge conflicts, see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line.

subhramit
subhramit previously approved these changes Mar 25, 2025
@trag-bot

trag-bot Bot commented Mar 25, 2025

Copy link
Copy Markdown

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

@Siedlerchr Siedlerchr added this pull request to the merge queue Mar 25, 2025
Merged via the queue into JabRef:main with commit afc71ed Mar 25, 2025
GuilhermeRibeiroPereira pushed a commit to GuilhermeRibeiroPereira/jabref that referenced this pull request Apr 1, 2025
…Ref#12815)

* Fix JabRef#11487: Refresh groupTree after removing group

* Refactor: Refresh groupTree after any group command

---------

Co-authored-by: Subhramit Basu <subhramit.bb@live.in>
krishnagjsForGit pushed a commit to krishnagjsForGit/jabref that referenced this pull request May 2, 2025
…Ref#12815)

* Fix JabRef#11487: Refresh groupTree after removing group

* Refactor: Refresh groupTree after any group command

---------

Co-authored-by: Subhramit Basu <subhramit.bb@live.in>
krishnagjsForGit pushed a commit to krishnagjsForGit/jabref that referenced this pull request May 2, 2025
…Ref#12815)

* Fix JabRef#11487: Refresh groupTree after removing group

* Refactor: Refresh groupTree after any group command

---------

Co-authored-by: Subhramit Basu <subhramit.bb@live.in>
ThiloteE added a commit that referenced this pull request Oct 21, 2025
closes #8012
closes #12815
closes #8217

Not sure, what commit exactly fixed all these issues, but since they have been very annoying to users, I think it's something worth mentioning in the changelog that they seem to be gone.

Successful commits could be found via [Git-bisect](https://git-scm.com/docs/git-bisect)

JabRef has become better and the 6.0 release is something to look forward to!
github-merge-queue Bot pushed a commit that referenced this pull request Oct 28, 2025
* Add fixed IndexOutOfBoundsException to CHANGELOG.md

closes #8012
closes #12815
closes #8217

Not sure, what commit exactly fixed all these issues, but since they have been very annoying to users, I think it's something worth mentioning in the changelog that they seem to be gone.

Successful commits could be found via [Git-bisect](https://git-scm.com/docs/git-bisect)

JabRef has become better and the 6.0 release is something to look forward to!

* Apply review comment

Co-authored-by: Subhramit Basu <subhramit.bb@live.in>

* Add #8281

---------

Co-authored-by: Subhramit Basu <subhramit.bb@live.in>
merlinymy pushed a commit to merlinymy/jabref that referenced this pull request Nov 19, 2025
* Add fixed IndexOutOfBoundsException to CHANGELOG.md

closes JabRef#8012
closes JabRef#12815
closes JabRef#8217

Not sure, what commit exactly fixed all these issues, but since they have been very annoying to users, I think it's something worth mentioning in the changelog that they seem to be gone.

Successful commits could be found via [Git-bisect](https://git-scm.com/docs/git-bisect)

JabRef has become better and the 6.0 release is something to look forward to!

* Apply review comment

Co-authored-by: Subhramit Basu <subhramit.bb@live.in>

* Add JabRef#8281

---------

Co-authored-by: Subhramit Basu <subhramit.bb@live.in>
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.

Error in group interface: Tooltip shown for groups without descrition can be a desription from some other group

7 participants