From cb175ec90bf0d2807560c8556995731b2eeaec00 Mon Sep 17 00:00:00 2001 From: Mathieu Hofman Date: Fri, 21 Jun 2024 20:46:55 +0000 Subject: [PATCH] fixup! fix(vow): handle resolution loops in vows add comment about reaching for vowV0 --- packages/vow/src/watch.js | 1 + packages/vow/src/when.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/packages/vow/src/watch.js b/packages/vow/src/watch.js index c8cca5d1ec5..9d9651ac8d0 100644 --- a/packages/vow/src/watch.js +++ b/packages/vow/src/watch.js @@ -94,6 +94,7 @@ const preparePromiseWatcher = (zone, isRetryableReason, watchNextStep) => const { watcher, watcherArgs, resolver, seenPayloads } = this.state; const payload = getVowPayload(value); if (payload) { + // TODO: rely on endowed helper to get storable cap from payload if (seenPayloads?.has(payload.vowV0)) { return this.self.onRejected(Error('Vow resolution cycle detected')); } diff --git a/packages/vow/src/when.js b/packages/vow/src/when.js index b76263a1701..e8e6c540ea2 100644 --- a/packages/vow/src/when.js +++ b/packages/vow/src/when.js @@ -30,6 +30,8 @@ export const makeWhen = ( let priorRetryValue; const seenPayloads = new WeakSet(); while (payload) { + // TODO: rely on endowed helpers for getting storable cap and performing + // shorten "next step" const { vowV0 } = payload; if (seenPayloads.has(vowV0)) { throw Error('Vow resolution cycle detected');