harden state durability and disable destructive snapshot sync
This commit is contained in:
@@ -23,6 +23,7 @@ export const saveSnapshot = mutation({
|
||||
args: {
|
||||
snapshot: v.any(),
|
||||
updatedAt: v.string(),
|
||||
syncToDomain: v.optional(v.boolean()),
|
||||
},
|
||||
handler: async (ctx, args) => {
|
||||
const latest = await ctx.db
|
||||
@@ -30,7 +31,10 @@ export const saveSnapshot = mutation({
|
||||
.order("desc")
|
||||
.first();
|
||||
|
||||
const syncSummary = await syncFromEngineSnapshot(ctx, args.snapshot);
|
||||
const shouldSync = Boolean(args.syncToDomain);
|
||||
const syncSummary = shouldSync
|
||||
? await syncFromEngineSnapshot(ctx, args.snapshot)
|
||||
: null;
|
||||
|
||||
if (latest) {
|
||||
await ctx.db.patch(latest._id, {
|
||||
|
||||
Reference in New Issue
Block a user