Skip to content

Commit 2e490c4

Browse files
authored
Update parse_array.dart
This fixes the issue because the **_handleSingleResult()** function which handles the response for a single parse object in the **_ParseResponseBuilder** was calling **_notifyChildrenAboutSave();** so when **save()** was called on any object it called **_notifyChildrenAboutSaving();** first and then in the response when **_notifyChildrenAboutSave();** was called, the **_estimatedArrayBeforeSaving** had values and _savedArray was not set as empty. But in case of other queries where single object was returned like **getUpdatedUser()** or **fetch()** on any object it just called **_notifyChildrenAboutSave();** in the **_handleSingleResult()** function which resulted in **_savedArray** being set as empty since **_estimatedArrayBeforeSaving** was null. I just added the null safety and not empty check before setting the **_savedArray** to **_estimatedArrayBeforeSaving** so now the savedArray is never returned empty in the response and the issue is resolved.
1 parent ec71870 commit 2e490c4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/dart/lib/src/objects/parse_array.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ class _ParseArray implements _Valuable<List>, _ParseSaveStateAwareChild {
6868
@mustCallSuper
6969
void onSaved() {
7070
setMode = false;
71+
if(_estimatedArrayBeforeSaving != null){
7172
_savedArray.clear();
72-
_savedArray.addAll(_estimatedArrayBeforeSaving ?? []);
73+
_savedArray.addAll(_estimatedArrayBeforeSaving!);
7374
_estimatedArrayBeforeSaving = null;
75+
}
7476

7577
if (_lastPreformedOperationBeforeSaving == lastPreformedOperation) {
7678
// No operations were performed during the save process

0 commit comments

Comments
 (0)