Skip to content

Fix search query reset issue after entry deletion#14063

Merged
Siedlerchr merged 4 commits into
JabRef:mainfrom
P1terW:fix-search-reset-on-delete
Oct 10, 2025
Merged

Fix search query reset issue after entry deletion#14063
Siedlerchr merged 4 commits into
JabRef:mainfrom
P1terW:fix-search-reset-on-delete

Conversation

@P1terW

@P1terW P1terW commented Oct 10, 2025

Copy link
Copy Markdown
Contributor

Closes #13984

This PR fixes the issue where search results would show stale entries after deleting entries from search results, making it appear as if the search query was reset even though it remained in the search bar.

Added an EntriesRemovedEvent listener to MainTableDataModel.SearchIndexListener that refreshes search matches when entries are removed from the database, ensuring the filtered list is properly updated to prevent stale entries and maintain the search query state during entry manipulation operations.

Steps to test

  1. Open JabRef and load a library with multiple entries
  2. Perform a search using the search bar (e.g., search for a specific author or keyword)
  3. Verify that search results are displayed correctly
  4. Select one or more entries from the search results
  5. Delete the selected entries (right-click → Delete or press Delete key)
  6. Verify that:
    • The search query remains in the search bar
    • Only remaining matching entries are displayed
    • No stale entries appear in the table
    • The search state is properly maintained

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • I manually tested my changes in running JabRef (always required)
  • [/] I added JUnit tests for changes (if applicable)
  • [/] I added screenshots in the PR description (if change is visible to the user)
  • I described the change in CHANGELOG.md in a way that is understandable for the average user (if change is visible to the user)
  • [/] I checked the user 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 updating file(s) in https://github.com/JabRef/user-documentation/tree/main/en.

- Add EntriesRemovedEvent listener to MainTableDataModel.SearchIndexListener
- Refresh search matches when entries are removed to prevent stale entries
- Ensure filtered list is properly updated after entry deletion
- Maintain search query state during entry manipulation operations

This fixes the issue where search results would show stale entries
after deleting entries from search results, making it appear as if
the search query was reset even though it remained in the search bar.
@github-actions

Copy link
Copy Markdown
Contributor

Hey @P1terW!

Thank you for contributing to JabRef! Your help is truly appreciated ❤️.

We have automatic checks in place, based on which you will soon get automated feedback if any of them are failing. We also use TragBot with custom rules that scans your changes and provides some preliminary comments, before a maintainer takes a look. TragBot is still learning, and may not always be accurate. In the "Files changed" tab, you can go through its comments and just click on "Resolve conversation" if you are sure that it is incorrect, or comment on the conversation if you are doubtful.

Please re-check our contribution guide in case of any other doubts related to our contribution workflow.

P1terW and others added 2 commits October 10, 2025 23:11
- Move EntriesRemovedEvent import to correct alphabetical position
- Fixes checkstyle ImportOrder violation
@P1terW

P1terW commented Oct 10, 2025

Copy link
Copy Markdown
Contributor Author

Before:
CleanShot 2025-10-10 at 22 17 18
After:
CleanShot 2025-10-10 at 22 34 10

@Siedlerchr Siedlerchr added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Oct 10, 2025
Siedlerchr
Siedlerchr previously approved these changes Oct 10, 2025
@Siedlerchr Siedlerchr disabled auto-merge October 10, 2025 18:05
@Siedlerchr Siedlerchr enabled auto-merge October 10, 2025 18:05
@Siedlerchr Siedlerchr disabled auto-merge October 10, 2025 18:05
@Siedlerchr Siedlerchr merged commit 765ed83 into JabRef:main Oct 10, 2025
53 of 61 checks passed
Shanaya-1981 pushed a commit to Shanaya-1981/jabref that referenced this pull request Oct 13, 2025
* Fix search query reset issue after entry deletion

- Add EntriesRemovedEvent listener to MainTableDataModel.SearchIndexListener
- Refresh search matches when entries are removed to prevent stale entries
- Ensure filtered list is properly updated after entry deletion
- Maintain search query state during entry manipulation operations

This fixes the issue where search results would show stale entries
after deleting entries from search results, making it appear as if
the search query was reset even though it remained in the search bar.

* Fix import order for EntriesRemovedEvent

- Move EntriesRemovedEvent import to correct alphabetical position
- Fixes checkstyle ImportOrder violation

* Update CHANGELOG with fixed issue description and link

---------

Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
merlinymy pushed a commit to merlinymy/jabref that referenced this pull request Nov 19, 2025
* Fix search query reset issue after entry deletion

- Add EntriesRemovedEvent listener to MainTableDataModel.SearchIndexListener
- Refresh search matches when entries are removed to prevent stale entries
- Ensure filtered list is properly updated after entry deletion
- Maintain search query state during entry manipulation operations

This fixes the issue where search results would show stale entries
after deleting entries from search results, making it appear as if
the search query was reset even though it remained in the search bar.

* Fix import order for EntriesRemovedEvent

- Move EntriesRemovedEvent import to correct alphabetical position
- Fixes checkstyle ImportOrder violation

* Update CHANGELOG with fixed issue description and link

---------

Co-authored-by: Carl Christian Snethlage <50491877+calixtus@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: maintable component: search first contrib status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unintentional reset of search query during manipulation of found entries.

3 participants