diff --git a/4chan_x.user.js b/4chan_x.user.js index b8777fa53..594cbcb84 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1404,8 +1404,12 @@ link.nextSibling.href = "/" + board + "/res/" + threadID + "#q" + postID; inBoard = g.boards[board] || new Board(board); inThread = g.threads["" + board + "." + threadID] || new Thread(threadID, inBoard); - post = new Post(pc, inThread, inBoard); - Main.callbackNodes(Post, [post]); + if (!(post = g.posts["" + board + "." + postID])) { + post = new Post(postContainer, thread, board, { + isArchived: true + }); + Main.callbackNodes(Post, [post]); + } if (!root.parentNode) { return; } @@ -1482,10 +1486,12 @@ }); board = g.boards[board] || new Board(board); thread = g.threads["" + board + "." + threadID] || new Thread(threadID, board); - post = new Post(postContainer, thread, board, { - isArchived: true - }); - Main.callbackNodes(Post, [post]); + if (!(post = g.posts["" + board + "." + postID])) { + post = new Post(postContainer, thread, board, { + isArchived: true + }); + Main.callbackNodes(Post, [post]); + } if (!root.parentNode) { return; } diff --git a/script.coffee b/script.coffee index d99f05cd0..540da4509 100644 --- a/script.coffee +++ b/script.coffee @@ -1194,8 +1194,12 @@ Get = new Board board inThread = g.threads["#{board}.#{threadID}"] or new Thread threadID, inBoard - post = new Post pc, inThread, inBoard - Main.callbackNodes Post, [post] + # In case of multiple callbacks for the same request, + # don't parse the same original post more than once. + unless post = g.posts["#{board}.#{postID}"] + post = new Post postContainer, thread, board, + isArchived: true + Main.callbackNodes Post, [post] # Stop here if the container has been removed while loading. return unless root.parentNode @@ -1283,9 +1287,12 @@ Get = new Board board thread = g.threads["#{board}.#{threadID}"] or new Thread threadID, board - post = new Post postContainer, thread, board, - isArchived: true - Main.callbackNodes Post, [post] + # In case of multiple callbacks for the same request, + # don't parse the same original post more than once. + unless post = g.posts["#{board}.#{postID}"] + post = new Post postContainer, thread, board, + isArchived: true + Main.callbackNodes Post, [post] # Stop here if the container has been removed while loading. return unless root.parentNode