diff --git a/src/data/placeBelow.js b/src/data/placeBelow.js index b5bdff4f2..2cd5cf854 100644 --- a/src/data/placeBelow.js +++ b/src/data/placeBelow.js @@ -64,7 +64,7 @@ function notifyLoading() { /** * A pack load that the loading status follows: on its way while it runs, - * failed until a later load of it succeeds. + * failed from a failure until it is tried again. * @template T * @param {string} name * @param {() => Promise} load @@ -72,6 +72,8 @@ function notifyLoading() { */ export function reportedPlacePackLoad(name, load) { return async () => { + // A retry is a fresh try: its batch ends on what this load does. + failedPacks.delete(name); loadingPacks.add(name); notifyLoading(); try { diff --git a/src/data/placePacksLoading.test.mjs b/src/data/placePacksLoading.test.mjs index 2d95afd49..03a9d9a52 100644 --- a/src/data/placePacksLoading.test.mjs +++ b/src/data/placePacksLoading.test.mjs @@ -32,6 +32,12 @@ test('a pack that would not load stays failed until it loads', async () => { await assert.rejects(load(), /offline/); assert.deepEqual(place.placePacksStatus(), { loading: false, failed: true }); fail = false; - assert.equal(await load(), 1); + const retry = load(); + assert.deepEqual( + place.placePacksStatus(), + { loading: true, failed: false }, + 'a retry is not a failure until it fails', + ); + assert.equal(await retry, 1); assert.deepEqual(place.placePacksStatus(), { loading: false, failed: false }); }); diff --git a/src/ui/placePacksLoading.test.mjs b/src/ui/placePacksLoading.test.mjs index 09db21fc3..44aab8836 100644 --- a/src/ui/placePacksLoading.test.mjs +++ b/src/ui/placePacksLoading.test.mjs @@ -56,4 +56,13 @@ test('a load that lands ends complete; one that fails ends failed', () => { batch([loading, { loading: false, failed: true }]).terminal, 'error', ); + // A retry after a failure that lands ends complete. + assert.equal( + batch([ + { loading: false, failed: true }, + loading, + { loading: false, failed: false }, + ]).terminal, + 'complete', + ); });