From e8cefcc2c65d8d290919333bf23ce737733fc572 Mon Sep 17 00:00:00 2001 From: Gnome Ann <> Date: Mon, 27 Sep 2021 23:10:34 -0400 Subject: [PATCH] (Firefox) Fix certain chunks not updating when editing I don't know why Firefox is so weird but we need to do this or else some chunks don't update properly when you edit multiple chunks at the same time. One example of when this happened is when you have a story with at least one chunk other than the prompt. Then, if you select the entire story except for the first few characters of the prompt and then delete the selected characters, and then defocus the story to save your changes, the last chunk in the story will not register as having been deleted, which you can verify if you refresh the page. Another example. If your story has a chunk with no trailing newlines followed by a chunk with exactly two leading newlines, if you delete the first newline from the latter chunk and then defocus to save your edits, the newline will be there again when you refresh the page. --- static/application.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/static/application.js b/static/application.js index 7c64b116..04a5a45b 100644 --- a/static/application.js +++ b/static/application.js @@ -950,11 +950,8 @@ function chunkOnDOMMutate(mutations, observer) { var nodes = []; for(var i = 0; i < mutations.length; i++) { var mutation = mutations[i]; - if(mutation.type === "childList") { - nodes = nodes.concat(Array.from(mutation.addedNodes), Array.from(mutation.removedNodes)); - } else { - nodes.push(mutation.target); - } + nodes = nodes.concat(Array.from(mutation.addedNodes), Array.from(mutation.removedNodes)); + nodes.push(mutation.target); } applyChunkDeltas(nodes); }