From bfb89e3e39ba993bd41286d657017374358401ce Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 24 Mar 2019 03:23:13 -0700 Subject: [PATCH] Handle aborting similarly in ExpandThread. --- src/Miscellaneous/ExpandThread.coffee | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Miscellaneous/ExpandThread.coffee b/src/Miscellaneous/ExpandThread.coffee index 31bef3bfb..e280d4caa 100644 --- a/src/Miscellaneous/ExpandThread.coffee +++ b/src/Miscellaneous/ExpandThread.coffee @@ -18,7 +18,9 @@ ExpandThread = disconnect: (refresh) -> return if g.VIEW is 'thread' or !Conf['Thread Expansion'] for threadID, status of ExpandThread.statuses - status.req?.abort() + if (oldReq = status.req) + delete status.req + oldReq.abort() delete ExpandThread.statuses[threadID] $.off d, 'IndexRefreshInternal', @onIndexRefresh unless refresh @@ -53,14 +55,16 @@ ExpandThread = ExpandThread.statuses[thread] = status = {} a.textContent = Build.summaryText '...', a.textContent.match(/\d+/g)... status.req = $.cache "#{location.protocol}//a.4cdn.org/#{thread.board}/thread/#{thread}.json", -> + return if @ isnt status.req # aborted delete status.req ExpandThread.parse @, thread, a contract: (thread, a, threadRoot) -> status = ExpandThread.statuses[thread] delete ExpandThread.statuses[thread] - if status.req - status.req.abort() + if (oldReq = status.req) + delete status.req + oldReq.abort() a.textContent = Build.summaryText '+', a.textContent.match(/\d+/g)... if a return