stack_trace icon indicating copy to clipboard operation
stack_trace copied to clipboard

Remove unused Chain.disable functionality

Open natebosch opened this issue 2 years ago • 3 comments

I cannot find any uses of the Chain.disable API outside of the tests in this package. It is unnecessary complexity. Removing the functionality may also remove some of the overhead from this package since we can omit a boolean check and reading a zone variable for every zone callback.

Any concerns @jakemac53 @lrhn ?

natebosch avatar Oct 18 '22 23:10 natebosch

Hmm, we might not be able to do a major version release because of flutter pinning. 😢

natebosch avatar Oct 18 '22 23:10 natebosch

No real opinion on removing the behavior. Sure, go for it!

The implementation looks potentially unsafe. If you disable stack chaining using this function, then start a new stack chaining inside it, then the value won't be correct. (It will enable the outer stack chaining zone as well).

The test, if anything, should be if (!identical(this, zone[Chain._specKey])) return parent.registerCallback(zone, f);, and then you don't need the extra boolean zone-variable.

(Don't read Zone.current in a zone callback, always use the zone parameter. A subzone might have chosen to change that argument deliberately.)

lrhn avatar Oct 19 '22 08:10 lrhn

If there is no known usage, I would be ok with removing this as a minor version bump. It will likely cause less pain than revving the whole ecosystem.

jakemac53 avatar Oct 19 '22 16:10 jakemac53