diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f3c3ca1d53..cf4354f3bac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -55,6 +55,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve ### Fixed +- We fixed that sorting of entries in the maintable by special fields is updated immediately [#9334](https://github.com/JabRef/jabref/issues/9334) - We fixed the Cleanup entries dialog is partially visible [#9223](https://github.com/JabRef/jabref/issues/9223) - We fixed the display of the "Customize Entry Types" dialogue title [#9198](https://github.com/JabRef/jabref/issues/9198) - We fixed an issue where author names with tilde accents (for example ñ) were marked as "Names are not in the standard BibTex format" [#8071](https://github.com/JabRef/jabref/issues/8071) diff --git a/src/main/java/org/jabref/gui/maintable/BibEntryTableViewModel.java b/src/main/java/org/jabref/gui/maintable/BibEntryTableViewModel.java index dcf6240fcea..da8c89c9e70 100644 --- a/src/main/java/org/jabref/gui/maintable/BibEntryTableViewModel.java +++ b/src/main/java/org/jabref/gui/maintable/BibEntryTableViewModel.java @@ -104,13 +104,24 @@ public ObservableValue> getMatchedGroups() { public ObservableValue> getSpecialField(SpecialField field) { OptionalBinding value = specialFieldValues.get(field); + // Fetch possibly updated value from BibEntry entry + Optional currentValue = this.entry.getField(field); if (value != null) { - return value; + if (currentValue.isEmpty() && value.getValue().isEmpty()) { + var zeroValue = getField(field).flatMapOpt(fieldValue -> field.parseValue("CLEAR_RANK").map(SpecialFieldValueViewModel::new)); + specialFieldValues.put(field, zeroValue); + return zeroValue; + } else if (value.getValue().isEmpty() || !value.getValue().get().getValue().getFieldValue().equals(currentValue)) { + // specialFieldValues value and BibEntry value differ => Set specialFieldValues value to BibEntry value + value = getField(field).flatMapOpt(fieldValue -> field.parseValue(fieldValue).map(SpecialFieldValueViewModel::new)); + specialFieldValues.put(field, value); + return value; + } } else { value = getField(field).flatMapOpt(fieldValue -> field.parseValue(fieldValue).map(SpecialFieldValueViewModel::new)); specialFieldValues.put(field, value); - return value; } + return value; } public ObservableValue getFields(OrFields fields) {