diff --git a/client/homebrew/pages/editPage/editPage.jsx b/client/homebrew/pages/editPage/editPage.jsx index 7e6c03473..8eb011cab 100644 --- a/client/homebrew/pages/editPage/editPage.jsx +++ b/client/homebrew/pages/editPage/editPage.jsx @@ -265,7 +265,7 @@ const EditPage = createClass({ brew.pageCount = ((brew.renderer=='legacy' ? brew.text.match(/\\page/g) : brew.text.match(/^\\page$/gm)) || []).length + 1; brew.patches = stringifyPatches(makePatches(this.savedBrew.text, brew.text)); brew.hash = await md5(this.savedBrew.text); - brew.text = undefined; + //brew.text = undefined; - Temporary parallel path brew.textBin = undefined; const transfer = this.state.saveGoogle == _.isNil(this.state.brew.googleId); diff --git a/server/homebrew.api.js b/server/homebrew.api.js index 84f639a4d..e34195ffa 100644 --- a/server/homebrew.api.js +++ b/server/homebrew.api.js @@ -340,7 +340,7 @@ const api = { const brewFromClient = api.excludePropsFromUpdate(req.body); const brewFromServer = req.brew; splitTextStyleAndMetadata(brewFromServer); - + brewFromServer.text = brewFromServer.text.normalize(); brewFromServer.hash = await md5(brewFromServer.text); @@ -357,15 +357,20 @@ const api = { let brew = _.assign(brewFromServer, brewFromClient); brew.title = brew.title.trim(); brew.description = brew.description.trim() || ''; + try { const patches = parsePatch(brewFromClient.patches); - brew.text = applyPatches(patches, brewFromServer.text)[0]; + // Patch to a throwaway variable while parallelizing - we're more concerned with error/no error. + const patchedResult = applyPatches(patches, brewFromServer.text)[0]; + // brew.text = applyPatches(patches, brewFromServer.text)[0]; } catch (err) { console.error('Failed to apply patches:', { - patches: brewFromClient.patches, - brewId: brew.editId || 'unknown' + patches : brewFromClient.patches, + brewId : brew.editId || 'unknown', + error : err }); - throw err; // rethrow to preserve the 500 behavior + // While running in parallel, don't throw the error upstream. + // throw err; // rethrow to preserve the 500 behavior } brew.text = api.mergeBrewText(brew);