Commit 439b24d
committed
fix(LeanObject): test existence more accurately
Previously, the code checks whether the object has an truthy objectId,
to determine the existence of a LeanCloud object.
But if the object is constructed via `query.get("nonexist_objectId")`,
then it does have an objectId (`{"objectId": "nonexist_objectId"}`).
Therefore, we check whether the object has the `createdAt` attribute
instead.
Also update the comments of `is_new` and `is_existed`,
to clarify their intented usage.1 parent fea3240 commit 439b24d
1 file changed
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
517 | 517 | | |
518 | 518 | | |
519 | 519 | | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
520 | 524 | | |
521 | 525 | | |
522 | 526 | | |
523 | 527 | | |
524 | 528 | | |
525 | | - | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
526 | 535 | | |
527 | 536 | | |
528 | 537 | | |
| |||
0 commit comments