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
If two functions are decorated of the same instance, their memoized values get mixed with the latest version (v9.0.0).
Take for example:
classTestClass{
@memDecorator()fn1(){return1;}
@memDecorator()counter2(){return2;}}constinstance=newTestClass();console.log(instance.fn1());// prints 1console.log(instance.fn2());// also prints 1 !!!
I would expect the second call to return 2, but it returns 1.
The memoized function in my understanding should be connected 1:1 to the combination of instance and propterty, whereas it is currently connected 1:1 to instances (#74).
I guess a little bit more complicated internal data structure is needed instead of the current implementation of decoratorInstanceMap, will open a PR that adds a test and demonstrates a possible solution.
The text was updated successfully, but these errors were encountered:
If two functions are decorated of the same instance, their memoized values get mixed with the latest version (
v9.0.0
).Take for example:
I would expect the second call to return 2, but it returns 1.
The memoized function in my understanding should be connected 1:1 to the combination of instance and propterty, whereas it is currently connected 1:1 to instances (#74).
I guess a little bit more complicated internal data structure is needed instead of the current implementation of
decoratorInstanceMap
, will open a PR that adds a test and demonstrates a possible solution.The text was updated successfully, but these errors were encountered: