Skip to content

Commit 418043b

Browse files
leekelleherCopilot
andauthored
Log Viewer: Fixes continuous polling (closes #20274) (#20310)
* LogViewer: Fixes continuous polling (closes #20274) * Update src/Umbraco.Web.UI.Client/src/packages/log-viewer/workspace/logviewer-workspace.context.ts Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent 65393ff commit 418043b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Umbraco.Web.UI.Client/src/packages/log-viewer/workspace/logviewer-workspace.context.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ export class UmbLogViewerWorkspaceContext extends UmbContextBase implements UmbW
124124
override hostDisconnected(): void {
125125
super.hostDisconnected();
126126
window.removeEventListener('changestate', this.onChangeState);
127+
this.stopPolling();
127128
}
128129

129130
onChangeState = () => {
@@ -320,7 +321,7 @@ export class UmbLogViewerWorkspaceContext extends UmbContextBase implements UmbW
320321
return;
321322
}
322323

323-
clearInterval(this.#intervalID as number);
324+
this.stopPolling();
324325
}
325326

326327
setPollingInterval(interval: UmbPoolingInterval) {
@@ -332,6 +333,13 @@ export class UmbLogViewerWorkspaceContext extends UmbContextBase implements UmbW
332333
const newDirection = direction === DirectionModel.ASCENDING ? DirectionModel.DESCENDING : DirectionModel.ASCENDING;
333334
this.#sortingDirection.setValue(newDirection);
334335
}
336+
337+
stopPolling() {
338+
if (this.#intervalID) {
339+
clearInterval(this.#intervalID);
340+
this.#intervalID = null;
341+
}
342+
}
335343
}
336344

337345
export { UmbLogViewerWorkspaceContext as api };

0 commit comments

Comments
 (0)