Skip to content

Commit

Permalink
fix: reload live clustermap on eventstream close
Browse files Browse the repository at this point in the history
prevents duplicate locations on eventstream reopen
  • Loading branch information
FreekBes committed Aug 6, 2024
1 parent f39e326 commit c48460d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions static/js/clustermaps/live.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ function initClustermaps() {
});
eventSource.addEventListener('error', function(event) {
console.error('EventSource failed:', event);
window.location.reload();
});
eventSource.addEventListener('open', function(event) {
console.log('EventSource opened');
});
eventSource.addEventListener('close', function(event) {
console.warn('EventSource closed:', event);
window.location.reload();
});

// Check for anchor link in the URL
Expand Down

0 comments on commit c48460d

Please sign in to comment.