I don't know the exact circumstances, but I'm getting errors because resultEqualityCheck gets a WeakRef instead of the expected Set:
Looks like the WeakRef is "cleared":
So this line would still keep the WeakRef in lastResultValue:
const lastResultValue = lastResult?.deref?.() ?? lastResult
Should better be:
const lastResultValue = lastResult?.deref ? lastResult.deref() : lastResult