Skip to content

Commit

Permalink
Use text dateType to avoid use of JSON.stringify
Browse files Browse the repository at this point in the history
  • Loading branch information
sevein committed Jun 21, 2024
1 parent a67dc5d commit 45c6acc
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/dashboard/src/media/js/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -864,9 +864,9 @@ BaseAppView = Backbone.View.extend({
// Check if the response from the API has changed since the last poll.
hasResponseChanged: function(response)
{
var next = JSON.stringify(response);
var changed = this.firstPoll || this.previousVersion !== next;
this.previousVersion = next;
var changed = this.firstPoll || this.previousVersion !== response;

this.previousVersion = response;

return changed;
},
Expand All @@ -877,7 +877,7 @@ BaseAppView = Backbone.View.extend({

$.ajax({
context: this,
dataType: 'json',
dataType: 'text',
type: 'GET',
url: this.statusUrl + '?' + new Date().getTime(),
beforeSend: function()
Expand All @@ -894,7 +894,9 @@ BaseAppView = Backbone.View.extend({
return;
}

var objects = response.objects;
var data = JSON.parse(response);
var objects = data.objects;

if (getURLParameter('paged'))
{
this.updateSips(objects);
Expand Down Expand Up @@ -933,7 +935,7 @@ BaseAppView = Backbone.View.extend({
}

// MCP status
if (response.mcp)
if (data.mcp)
{
window.statusWidget.connect();
}
Expand Down

0 comments on commit 45c6acc

Please sign in to comment.