* 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 <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -124,6 +124,7 @@ export class UmbLogViewerWorkspaceContext extends UmbContextBase implements UmbW
|
||||
override hostDisconnected(): void {
|
||||
super.hostDisconnected();
|
||||
window.removeEventListener('changestate', this.onChangeState);
|
||||
this.stopPolling();
|
||||
}
|
||||
|
||||
onChangeState = () => {
|
||||
@@ -320,7 +321,7 @@ export class UmbLogViewerWorkspaceContext extends UmbContextBase implements UmbW
|
||||
return;
|
||||
}
|
||||
|
||||
clearInterval(this.#intervalID as number);
|
||||
this.stopPolling();
|
||||
}
|
||||
|
||||
setPollingInterval(interval: UmbPoolingInterval) {
|
||||
@@ -332,6 +333,13 @@ export class UmbLogViewerWorkspaceContext extends UmbContextBase implements UmbW
|
||||
const newDirection = direction === DirectionModel.ASCENDING ? DirectionModel.DESCENDING : DirectionModel.ASCENDING;
|
||||
this.#sortingDirection.setValue(newDirection);
|
||||
}
|
||||
|
||||
stopPolling() {
|
||||
if (this.#intervalID) {
|
||||
clearInterval(this.#intervalID);
|
||||
this.#intervalID = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { UmbLogViewerWorkspaceContext as api };
|
||||
|
||||
Reference in New Issue
Block a user