Skip to content

Commit

Permalink
Clean-up on disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWicklowWolf authored Jun 10, 2024
1 parent 67dc09f commit 38e5c54
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,7 @@ socket.on('more_artists_loaded', function (data) {
});

socket.on('clear', function () {
var artist_row = document.getElementById('artist-row');
var artist_cards = artist_row.querySelectorAll('#artist-column');
artist_cards.forEach(function (card) {
card.remove();
});
clear_all();
});

socket.on("new_toast_msg", function (data) {
Expand All @@ -331,8 +327,17 @@ socket.on("new_toast_msg", function (data) {

socket.on("disconnect", function () {
show_toast("Connection Lost", "Please reconnect to continue.");
clear_all();
});

function clear_all() {
var artist_row = document.getElementById('artist-row');
var artist_cards = artist_row.querySelectorAll('#artist-column');
artist_cards.forEach(function (card) {
card.remove();
});
}

var preview_modal;
let preview_request_flag = false;

Expand Down

0 comments on commit 38e5c54

Please sign in to comment.