python-sdk icon indicating copy to clipboard operation
python-sdk copied to clipboard

save 的行为和 JS SDK 不一致

Open weakish opened this issue 5 years ago • 0 comments

const d = await new AV.Query('TestObject').get('5f27bc73fbb489000824300d')
console.log(d.get('testList'))
listData = d.get('testList')
listData.push('debug')
await d.save()

上面这段 JS 代码,最终云端的 testList 会包含 debug 这个值,但是等效的 Python 代码,testList 并不会包含 debug 这个值。 python SDK 的 save 没有 JS SDK 的这么智能。python SDK 只有在调用 set 方法(或 add_unique 之类的类 set 方法时才会更新内部维护的 _changes 状态,最终在 save 时将更新发送给云端)。python SDK 的行为实现上更简单,但可能导致用户感到困惑。下一个大版本需要考虑是否需要把行为改成和 JS SDK 一致。

相关论坛帖子 23120

weakish avatar Aug 03 '20 09:08 weakish