a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

remove logs, prevent rebase mutations adding to undo

+5 -6
+2 -4
components/Blocks/TextBlock/index.tsx
··· 226 226 if (!editorState) { 227 227 let km = TextBlockKeymap(propsRef, repRef, rep.undoManager); 228 228 setEditorState(props.entityID, { 229 - keymap: km, 230 229 editor: EditorState.create({ 231 230 schema, 232 231 plugins: [ ··· 269 268 if (!existingState) return s; 270 269 let newState = existingState.editor.apply(tr); 271 270 let addToHistory = tr.getMeta("addToHistory"); 272 - console.log(addToHistory); 273 271 if (addToHistory !== false) { 272 + let docHasChanges = !tr.steps.length || tr.docChanged; 273 + if (addToHistory !== false && docHasChanges) { 274 274 if (actionTimeout.current) { 275 275 window.clearTimeout(actionTimeout.current); 276 276 } else { 277 - console.log("starting group"); 278 277 rep.undoManager.startGroup(); 279 278 } 280 279 281 280 actionTimeout.current = window.setTimeout(() => { 282 281 rep.undoManager.endGroup(); 283 - console.log("ending group"); 284 282 actionTimeout.current = null; 285 283 }, 200); 286 284 rep.undoManager.add({
+1
src/replicache/clientMutationContext.ts
··· 73 73 } else { 74 74 if (attribute.cardinality === "one" && !f.id) 75 75 rep.mutate.retractAttribute({ 76 + ignoreUndo: true, 76 77 attribute: f.attribute as keyof FilterAttributes<{ 77 78 cardinality: "one"; 78 79 }>,
+2 -2
src/replicache/index.tsx
··· 100 100 Object.keys(mutations).map((m) => { 101 101 return [ 102 102 m, 103 - async (tx: WriteTransaction, args: any) => { 103 + async (tx: WriteTransaction, args: any, ...rest) => { 104 104 await mutations[m as keyof typeof mutations]( 105 105 args, 106 106 clientMutationContext(tx, { 107 107 undoManager, 108 108 rep: newRep, 109 - ignoreUndo: args.ignoreUndo, 109 + ignoreUndo: args.ignoreUndo || tx.reason !== "initial", 110 110 defaultEntitySet: 111 111 props.token.permission_token_rights[0]?.entity_set, 112 112 }),