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
I understand initializing when the argument is undefined, but I think initializing it even when it is an empty array is excessive.
It seems troublesome for developers to classify each case.
If the argument is dynamic, it may lead to unexpected behavior.
(However, it seems difficult to distinguish this technically. Is there a good way?)
constenableMyHandlers=(handlers)=>{// hmm... handlers.length could be 0. In this case, I don't think there should be any handlers active.worker.resetHandlers(...handlers)}constinitHandlers=()=>{// Unlike the above function, this is to obtain the first handler.worker.resetHandlers()}
If I can clear the handler, it may be a bit inconvenient, but I think it can be done anyway.
Well, first, let’s create a PR this way. If it's strange, let's discuss another method!
Hi, @nayounsang. Can you please explain what you are trying to achieve here?
Do I understand it right that since nextHandlers.length will be 0 in the case of .resetHandlers() call, the code will put [...this.initialHandlers] back as the active handlers while you want zero handlers to be active?
One way you can get this behavior even now is relying on .use() instead of the base handlers:
This won't treat handlers as initial handlers, so calling worker.resetHandlers() will remove them entirely or replace them with a list of newly provided handlers.
I may even argue that this usage is more correct. Initial, or happy path handlers, aren't meant to be removed. They can be replaced as if to say "now I have a different set of happy path handlers", but removing them entirely may lead to unexpected behaviors if you call .resetHandlers() accidentally in a test.
Scope
Adds a new behavior
Compatibility
Feature description
I understand initializing when the argument is undefined, but I think initializing it even when it is an empty array is excessive.
It seems troublesome for developers to classify each case.
If the argument is dynamic, it may lead to unexpected behavior.
(However, it seems difficult to distinguish this technically. Is there a good way?)
If I can clear the handler, it may be a bit inconvenient, but I think it can be done anyway.
Well, first, let’s create a PR this way. If it's strange, let's discuss another method!
The text was updated successfully, but these errors were encountered: