@qiaopeng/tanstack-query-plus 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -70,16 +70,16 @@ export function useDataGuardMutation(mutationFn, queryKey, options) {
|
|
|
70
70
|
}
|
|
71
71
|
// 标记最近更新的项
|
|
72
72
|
const withMark = markRecentlyUpdated(updated, variables.id);
|
|
73
|
-
//
|
|
74
|
-
if (old.version !== undefined) {
|
|
73
|
+
// 乐观更新版本号(安全检查:确保 old 存在)
|
|
74
|
+
if (old && old.version !== undefined) {
|
|
75
75
|
withMark.version = old.version + 1;
|
|
76
76
|
}
|
|
77
|
-
//
|
|
78
|
-
if (old.updatedAt !== undefined) {
|
|
77
|
+
// 乐观更新时间戳(安全检查:确保 old 存在)
|
|
78
|
+
if (old && old.updatedAt !== undefined) {
|
|
79
79
|
withMark.updatedAt = new Date().toISOString();
|
|
80
80
|
}
|
|
81
|
-
//
|
|
82
|
-
if (old._hash !== undefined) {
|
|
81
|
+
// 更新哈希(安全检查:确保 old 存在)
|
|
82
|
+
if (old && old._hash !== undefined) {
|
|
83
83
|
withMark._hash = hashObject(withMark.items);
|
|
84
84
|
}
|
|
85
85
|
return withMark;
|
package/package.json
CHANGED