mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-05 08:02:42 +00:00
On patch failure, compare client and server text bytewise
This commit is contained in:
@@ -11,7 +11,7 @@ import { nanoid } from 'nanoid';
|
||||
import {makePatches, applyPatches, stringifyPatches, parsePatch} from '@sanity/diff-match-patch';
|
||||
import { md5 } from 'hash-wasm';
|
||||
import { splitTextStyleAndMetadata,
|
||||
brewSnippetsToJSON } from '../shared/helpers.js';
|
||||
brewSnippetsToJSON, debugTextMismatch } from '../shared/helpers.js';
|
||||
import checkClientVersion from './middleware/check-client-version.js';
|
||||
|
||||
|
||||
@@ -364,6 +364,7 @@ const api = {
|
||||
const patchedResult = applyPatches(patches, brewFromServer.text)[0];
|
||||
// brew.text = applyPatches(patches, brewFromServer.text)[0];
|
||||
} catch (err) {
|
||||
debugTextMismatch(brewFromClient.text, brewFromServer.text, `edit/${brewFromClient.editId}`);
|
||||
console.error('Failed to apply patches:', {
|
||||
patches : brewFromClient.patches,
|
||||
brewId : brew.editId || 'unknown',
|
||||
|
||||
Reference in New Issue
Block a user