Have historyWatch report errors via notifyError instead of an onError callback.

This commit is contained in:
seb
2026-08-05 09:54:33 +02:00
parent 44d69e541c
commit c1545b6114
3 changed files with 5 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
import { requireArray, requireDefined, requireObject } from '../utils/apiShape';
import { notifyError } from '../utils/notify';
import { ApiClient } from './ApiClient';
/**
@@ -84,10 +85,9 @@ export class StorageManager extends ApiClient {
* Fetch article history, then refetch whenever SSE emits `article-<sku>`.
* @param {string} sku
* @param {(history: unknown[]) => void} onHistory
* @param {(err: unknown) => void} onError
* @returns {() => void} unwatch
*/
watchArticleHistory(sku, onHistory, onError) {
watchArticleHistory(sku, onHistory) {
const key = String(sku);
let active = true;
@@ -101,7 +101,7 @@ export class StorageManager extends ApiClient {
const run = () =>
void refresh().catch((err) => {
if (!active) return;
onError(err);
notifyError(err);
});
let watchers = this.#historyWatchers.get(key);