You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After running into an issue with Gitea and their devs tracing it back to github text-expander and then to here as a dependency, I'd like to point out the following:
Using WeakRef in any capacity outside of extremely specific situations (and tailor-made code) is strongly discouraged. e.g. the W3C TAG Design Principles group has a number of cautionary notes about it, and in many cases calling the WeakRef API and creating the associated finalization objects on resources is not helping with GC but rather a hindrance. It should never be incorporated in generic libraries or broadly-used dependencies.
It's also entirely unclear why you chose to use WeakRef in this situation to begin with; I think it doesn't do what you suppose it does. Calling .deref() does not immediately GC it nor does it guarantee anything about how safe the object is to garbage collect. Your assumption that the input gets garbage collected on unmount immediately is incorrect. .deref() is also not a magic wand to avoid having to properly release references to objects, as finalizers may or may not be called after .deref()-ing an object. At most they are hints to the garbage collector but any existing (stronger) ref won't be blown away by this.
Calls to WeakRef's CTOR are also not supported by all browser engines (which is what started the Gitea issue to begin with), and where they are supported, they are not at all reliable.
You may want to revert (part of) commit b220c7e and avoid calling the WeakRef API in the future.
The text was updated successfully, but these errors were encountered:
After running into an issue with Gitea and their devs tracing it back to github text-expander and then to here as a dependency, I'd like to point out the following:
dom-input-range/src/input-style-clone-element.ts
Line 72 in 5e51f15
Using
WeakRef
in any capacity outside of extremely specific situations (and tailor-made code) is strongly discouraged. e.g. the W3C TAG Design Principles group has a number of cautionary notes about it, and in many cases calling theWeakRef
API and creating the associated finalization objects on resources is not helping with GC but rather a hindrance. It should never be incorporated in generic libraries or broadly-used dependencies.It's also entirely unclear why you chose to use
WeakRef
in this situation to begin with; I think it doesn't do what you suppose it does. Calling.deref()
does not immediately GC it nor does it guarantee anything about how safe the object is to garbage collect. Your assumption that the input gets garbage collected on unmount immediately is incorrect..deref()
is also not a magic wand to avoid having to properly release references to objects, as finalizers may or may not be called after.deref()
-ing an object. At most they are hints to the garbage collector but any existing (stronger) ref won't be blown away by this.Calls to
WeakRef
's CTOR are also not supported by all browser engines (which is what started the Gitea issue to begin with), and where they are supported, they are not at all reliable.You may want to revert (part of) commit b220c7e and avoid calling the WeakRef API in the future.
The text was updated successfully, but these errors were encountered: