Change Tokens and Duplicate OnChange firing in rapid succession #36045
Labels
area-Extensions-Primitives
documentation
Documentation bug or enhancement, does not impact product or test code
help wanted
[up-for-grabs] Good issue for external contributors
Milestone
I'm opening this issue again, as per guidance from @guardrex
The reasons for me opening this again, are that the issues linked above to track the problem have been closed by engineering, however:
The problem has been acknowledged, but still exists unresolved - i.e no framework provided solution or workarounds. This also mean no adequately tested / officially approved workarounds.
Developers won't expect an API named
OnChange
to fire twice in rapid succession when there is a single change to a file. So I think this is still very likely to cause developers issues when using this API.Without any official debouncing methods that are readily adoptable to developers who encounter this, they will have to spend time rolling (and testing) their own solutions. This is a time sink that would be much more efficiently fixed at the source by the framework providing a couple of approved and tested methods for this. The documented workaround provided by @guardrex may help developers to a limited degree, but it is limited because it has no real tests so could exhibit bugs, and sha1 checking may cause other problems later when the application is scaled out or large files are introduced - so could actually lead them down a bad path without these considerations being pointed out. Also the documented sample code is not in a form that is readily adoptable and maintainable in a central location - if for example bugs are discovered, then each developer will most likely have their own copied and pasted version to maintain.
The approach in the gist with the configurable delay is probably much more robust than the documented sha1 checking approach, as long as you configure a sensible delay.
I don't believe it would take that much effort on the part of engineering to provide some framework approved debouncing implementations to resolve this issue, either including them as optional API's in the same package as
ChangeToken
itself or an optional support package, and then update the docs to document each of those. The gist I feel is probably the most broadly applicable'/ widely useful solution to this - with barely any dependencies at all, and could probably more easily be included out of the box than something like the sha1 check though imho.I appreciate you want to get on and deliver other features. Users of the framework are like-minded in that regard.
Describe the bug
The bug is already well described in the issues linked above.
To Reproduce
See linked issues.
Further technical details
See linked issues.
The text was updated successfully, but these errors were encountered: