Fix message duplicates on history load
Este commit está contenido en:
padre
46cf6f40aa
commit
97c0d34159
Se han modificado 1 ficheros con 7 adiciones y 1 borrados
|
@ -87,7 +87,13 @@ public class ChatHistory {
|
|||
* @param message The message to add
|
||||
*/
|
||||
public void addMessage(Message message, ErrorCallback errorCallback) {
|
||||
db.addMessage(message, () -> Platform.runLater(() -> history.add(message)), errorCallback);
|
||||
db.addMessage(message, () -> {
|
||||
// Add message to active history only if we already fetched it from db
|
||||
// This prevents duplicates when loading the db
|
||||
if (historyLoaded) {
|
||||
Platform.runLater(() -> history.add(message));
|
||||
}
|
||||
}, errorCallback);
|
||||
}
|
||||
|
||||
public interface HistoryLoadedCallback {
|
||||
|
|
Cargando…
Referenciar en una nueva incidencia