Skip to content

Commit 8262c5c

Browse files
egeozcanclaude
andcommitted
fix(timeline): centralize preview-fetch abort in closePreview (closes #52)
Re-applies PR #52 (which had forked 77 commits behind master) onto current master: moves the in-flight preview abort out of selectBar's toggle-off path and into closePreview, so every close path (toggle-off, navigation, granularity/mode changes) aborts a pending preview fetch instead of only the toggle-off case. Rebuilds public/dist/main.js and gitignores server.log (the stray build-log this PR had accidentally committed). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8a0f557 commit 8262c5c

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
/public/*.html
1616
/*.output.png
1717
/=file
18+
/server.log
1819
.aider*
1920

2021
# E2E test artifacts

public/dist/main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/timeline.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,11 +280,6 @@ export default function timeline({ apiUrl, entityType, defaultView }) {
280280
async selectBar(index, barType) {
281281
// Toggle off if clicking same bar
282282
if (this.selectedBar === index && this.selectedBarType === barType) {
283-
// P3 fix: abort in-flight preview before closing
284-
if (this._previewAborter) {
285-
this._previewAborter();
286-
this._previewAborter = null;
287-
}
288283
this.closePreview();
289284
this.renderChart();
290285
return;
@@ -372,6 +367,13 @@ export default function timeline({ apiUrl, entityType, defaultView }) {
372367
},
373368

374369
closePreview() {
370+
// Abort any in-flight preview fetch so a slow response can't land
371+
// after the panel has been closed. Centralized here so every close
372+
// path (toggle-off, navigation, granularity/mode changes) aborts.
373+
if (this._previewAborter) {
374+
this._previewAborter();
375+
this._previewAborter = null;
376+
}
375377
this.selectedBar = null;
376378
this.selectedBarType = null;
377379
this.previewHtml = '';

0 commit comments

Comments
 (0)