Closed mfbx9da4 closed 10 months ago
https://github.com/bloomberg/record-tuple-polyfill/blob/5f9cae34f0d331c4836efbc9cd618836c03e75f5/packages/record-tuple-polyfill/src/interngraph.js#L55
Theoretically couldn't the value be garbage collected between calls to ref.deref()? So therefore InternGraph.deref() could return undefined?
ref.deref()
InternGraph.deref()
undefined
if (ref && ref.deref()) { return ref.deref(); }
Suggestion:
const existingValue = ref?.deref() if (existingValue) { return existingValue; }
foo.deref() is guaranteed to return the same value when called in the same synchronous execution. Forcing a GC between the 2 calls here will never return undefined for the second call by spec
foo.deref()
https://github.com/bloomberg/record-tuple-polyfill/blob/5f9cae34f0d331c4836efbc9cd618836c03e75f5/packages/record-tuple-polyfill/src/interngraph.js#L55
Theoretically couldn't the value be garbage collected between calls to
ref.deref()
? So thereforeInternGraph.deref()
could returnundefined
?Suggestion: