Skip to content

Commit

Permalink
fixup! fix(vow): handle resolution loops in vows
Browse files Browse the repository at this point in the history
add comment about reaching for vowV0
  • Loading branch information
mhofman committed Jun 22, 2024
1 parent 14e6447 commit cb175ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/vow/src/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
Expand Down
2 changes: 2 additions & 0 deletions packages/vow/src/when.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit cb175ec

Please sign in to comment.