From 1206941d885481e9665aa9d4453465e63dc1bbbb Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sun, 11 Oct 2020 08:11:59 -0700 Subject: [PATCH] Remove unnecessary guard in refresh history callback The function ajaxForm() rejects the fetch promise when the response is not a 200, so we can assume that if the code is being executed a 200 was returned. In the event a 200 is returned, the requests attribute is always a JavaScript Array. --- .../static/debug_toolbar/js/history.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/debug_toolbar/static/debug_toolbar/js/history.js b/debug_toolbar/static/debug_toolbar/js/history.js index 7764ed0a1..e0a617d09 100644 --- a/debug_toolbar/static/debug_toolbar/js/history.js +++ b/debug_toolbar/static/debug_toolbar/js/history.js @@ -29,16 +29,12 @@ $$.on(djDebug, "click", ".refreshHistory", function (event) { event.preventDefault(); const container = djDebug.querySelector("#djdtHistoryRequests"); ajaxForm(this).then(function (data) { - if (data.requests.constructor === Array) { - data.requests.forEach(function (request) { - if ( - !container.querySelector( - '[data-store-id="' + request.id + '"]' - ) - ) { - container.innerHTML = request.content + container.innerHTML; - } - }); - } + data.requests.forEach(function (request) { + if ( + !container.querySelector('[data-store-id="' + request.id + '"]') + ) { + container.innerHTML = request.content + container.innerHTML; + } + }); }); });