Commit fdfd0d1d authored by Yusuke Iwaki's avatar Yusuke Iwaki Committed by GitHub

Merge pull request #127 from RocketChat/fix_realm_object_listener

fix the issue that RealmObjectObserver's callback is called repeatedly
parents 6b8122be 1ec79026
......@@ -30,7 +30,7 @@ public class RealmListObserver<T extends RealmObject> extends AbstractRealmResul
@Override
public final RealmChangeListener<RealmResults<T>> getListener() {
return results -> {
String currentResultString = results != null ? results.toString() : null;
String currentResultString = results != null ? results.toString() : "";
if (previousResultsString != null && previousResultsString.equals(currentResultString)) {
return;
}
......
......@@ -37,7 +37,7 @@ public class RealmObjectObserver<T extends RealmObject> extends AbstractRealmRes
protected final RealmChangeListener<RealmResults<T>> getListener() {
return element -> {
T currentResult = impl.extractObjectFromResults(element);
String currentResultString = currentResult != null ? currentResult.toString() : null;
String currentResultString = currentResult != null ? currentResult.toString() : "";
if (previousResultString != null && previousResultString.equals(currentResultString)) {
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment