Skip to content

Conversation

@LangInteger
Copy link
Contributor

@LangInteger LangInteger commented Dec 30, 2025

User description

Closes #14757

I have made one change:
- 1. Only show the "Restart search" button when the fetch failed

    1. Let the “Restart search” button to bypass the cache

Steps to test

    1. start -> New empty library
    1. add example entry
    1. only the only newly added entry
    1. check DOI exists in the General panel
    1. switch to Citations panel
    • both the "cite" and "cited by" have a restart search button
    • click the button, the search will start with bypassing local cache

Please refer to the video below:

test2.mov

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.

PR Type

Bug fix


Description

  • Only show restart search button when citation fetch fails

  • Trigger searches for both cite and cited sides when switching fetchers

  • Hide refresh button on successful search completion


Diagram Walkthrough

flowchart LR
  A["Fetcher Changed"] --> B["Search Both Sides"]
  B --> C["Cite Search"]
  B --> D["Cited By Search"]
  C --> E{Success?}
  D --> E
  E -->|Yes| F["Hide Refresh Button"]
  E -->|No| G["Show Refresh Button"]
  F --> H["Show Import Button"]
  G --> H
Loading

File Walkthrough

Relevant files
Bug fix
CitationRelationsTab.java
Fix dual-side search and refresh button visibility             

jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java

  • Added second searchForRelations call to trigger searches for both cite
    and cited sides when fetcher changes
  • Modified onSearchForRelationsSucceed to hide refresh button on
    successful search completion
  • Removed refresh button from being shown after successful search
    results
+3/-2     
Documentation
CHANGELOG.md
Document citation-relation panel fixes                                     

CHANGELOG.md

+2/-1     

@github-actions github-actions bot added good second issue Issues that involve a tour of two or three interweaved components in JabRef status: changes-required Pull requests that are not yet complete labels Dec 30, 2025
@LangInteger LangInteger marked this pull request as ready for review December 30, 2025 11:16
@qodo-free-for-open-source-projects
Copy link
Contributor

qodo-free-for-open-source-projects bot commented Dec 30, 2025

PR Compliance Guide 🔍

Below is a summary of compliance checks for this PR:

Security Compliance
🟢
No security concerns identified No security vulnerabilities detected by AI analysis. Human verification advised for critical code.
Ticket Compliance
🟡
🎫 #13109
🔴 Add pseudonymization functionality to the CLI
Make org.jabref.logic.pseudonymization.Pseudonymization available on the command line
interface
Implement similar CLI experience as the consistency check
Follow the implementation pattern of org.jabref.cli.CheckConsistency class
Codebase Duplication Compliance
Codebase context is not defined

Follow the guide to enable codebase context checks.

Custom Compliance
🟢
Generic: Comprehensive Audit Trails

Objective: To create a detailed and reliable record of critical system actions for security analysis
and compliance.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Meaningful Naming and Self-Documenting Code

Objective: Ensure all identifiers clearly express their purpose and intent, making code
self-documenting

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Robust Error Handling and Edge Case Management

Objective: Ensure comprehensive error handling that provides meaningful context and graceful
degradation

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Error Handling

Objective: To prevent the leakage of sensitive system information through error messages while
providing sufficient detail for internal debugging.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Secure Logging Practices

Objective: To ensure logs are useful for debugging and auditing without exposing sensitive
information like PII, PHI, or cardholder data.

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

Generic: Security-First Input Validation and Data Handling

Objective: Ensure all data inputs are validated, sanitized, and handled securely to prevent
vulnerabilities

Status: Passed

Learn more about managing compliance generic rules or creating your own custom rules

  • Update
Compliance status legend 🟢 - Fully Compliant
🟡 - Partial Compliant
🔴 - Not Compliant
⚪ - Requires Further Human Verification
🏷️ - Compliance label

@qodo-free-for-open-source-projects
Copy link
Contributor

qodo-free-for-open-source-projects bot commented Dec 30, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Cancel both background search tasks

Cancel the citedByTask in addition to the citingTask when the citation fetcher
changes. This prevents potential race conditions and unnecessary background
processing.

jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java [467-473]

 // Cancel any running searches so they don't continue with the old fetcher
 if (citingTask != null && !citingTask.isCancelled()) {
     citingTask.cancel();
+}
+if (citedByTask != null && !citedByTask.isCancelled()) {
+    citedByTask.cancel();
 }
 entryEditorPreferences.setCitationFetcherType(newValue);
 searchForRelations(citingComponents, citedByComponents);
 searchForRelations(citedByComponents, citingComponents);

[To ensure code accuracy, apply this suggestion manually]

Suggestion importance[1-10]: 8

__

Why: The suggestion correctly identifies that when the fetcher is changed, the citedByTask is not cancelled, unlike the citingTask. This could lead to unnecessary resource usage and potential race conditions, as both tasks are re-triggered by the PR's changes.

Medium
  • Update

@github-actions github-actions bot removed the status: changes-required Pull requests that are not yet complete label Dec 30, 2025
@calixtus
Copy link
Member

I think this PR does not closes the issue. The issue description states:

If citations were successfully (!) fetched, there is no possibility to "Restart" the search. The button just refreshes the display.

This PR disables the restart button after the citations have been fetched.

@LangInteger
Copy link
Contributor Author

I think this PR does not closes the issue. The issue description states:

If citations were successfully (!) fetched, there is no possibility to "Restart" the search. The button just refreshes the display.

This PR disables the restart button after the citations have been fetched.

@calixtus

The issue states that after citations are successfully fetched, there is no real possibility to “Restart” the search, and the button becomes misleading.

Since a restart is not supported in that state, this PR hides/disables the button once the fetch succeeds and only shows it when an error occurs during the fetch process.

I’m happy to consider alternative approaches if you have a different suggestion in mind.

@calixtus
Copy link
Member

I see. What if the user selects the other provider to search for citations?

@LangInteger
Copy link
Contributor Author

I see. What if the user selects the other provider to search for citations?

Screen.Recording.2025-12-31.at.01.37.26.mov

The left citation side will be refreshed, and the restart button may appear again if that refresh fails.
Check the above video for this scenario.

@calixtus
Copy link
Member

@koppor is this the behavior you desire? I think it's ok, since the result of a search for citations probably won't change that quickly

@calixtus
Copy link
Member

Btw the title of the issue was " 'Restart search" should restart search"

@github-actions
Copy link
Contributor

github-actions bot commented Jan 1, 2026

Your pull request conflicts with the target branch.

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

@github-actions github-actions bot removed the status: changes-required Pull requests that are not yet complete label Jan 1, 2026
Comment on lines +480 to +481
searchForRelations(citingComponents, citedByComponents, false);
searchForRelations(citedByComponents, citingComponents, false);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

switch to the tab will not trigger refresh from the remote

}
entryEditorPreferences.setCitationFetcherType(newValue);
searchForRelations(citingComponents, citedByComponents);
searchForRelations(citingComponents, citedByComponents, true);
Copy link
Contributor Author

@LangInteger LangInteger Jan 2, 2026

Choose a reason for hiding this comment

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

switch the fetcher will not trigger refresh from the remote

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the last parameter has been updated to false

Comment on lines +456 to +457
refreshCitingButton.setOnMouseClicked(_ -> searchForRelations(citingComponents, citedByComponents, true));
refreshCitedByButton.setOnMouseClicked(_ -> searchForRelations(citedByComponents, citingComponents, true));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

click refresh button will trigger refresh from the remote

Comment on lines +708 to +709
executeSearch(citationComponents, true);
executeSearch(otherCitationComponents, true);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if the DOI is successfully looked up (requested by the user), trigger refresh from the remote

@LangInteger LangInteger changed the title Only show restart search button in citation-relation panel when the fetch failed Only show restart search button in citation-relation panel when the fetch failed and make it to bypass the cache Jan 2, 2026
@github-actions github-actions bot added the status: changes-required Pull requests that are not yet complete label Jan 4, 2026
@subhramit
Copy link
Member

subhramit commented Jan 7, 2026

Hey @LangInteger !
is this PR ready for review?

@LangInteger
Copy link
Contributor Author

@subhramit Hi, yes this PR is ready for review. As mentioned in the introduction, it does two things:

    1. Only show the "Restart search" button when the fetch failed
    1. Let the “Restart search” button to bypass the cache

However, I do want to confirm with @koppor , do you want both changes, or the second one is enough?

@koppor
Copy link
Member

koppor commented Jan 20, 2026

2. Let the “Restart search” button to bypass the cache

Only this, because the user might want to see if there are new cites.

@LangInteger LangInteger changed the title Only show restart search button in citation-relation panel when the fetch failed and make it to bypass the cache Restart search button in citation-relation panel should bypass the cache Jan 20, 2026
@github-actions github-actions bot removed the status: changes-required Pull requests that are not yet complete label Jan 20, 2026
@LangInteger
Copy link
Contributor Author

  1. Let the “Restart search” button to bypass the cache

Only this, because the user might want to see if there are new cites.

@koppor Ok. I have removed changes for 1.
The change is not unit-test friendly. So I did not add any test cases. Is that ok?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: citation-relations component: entry-editor good second issue Issues that involve a tour of two or three interweaved components in JabRef Review effort 2/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Restart search" should restart search

4 participants