Closed ricardomatias closed 5 years ago
You appear to be creating a new function and executing it every time scale is called?
Yes, I'm using getters so I only derive the scale, once the someone tries to access the property. As an improvement I thought about adding memoizing, but somehow the function createScale is being triggered, even when the arguments don't change.
Well of course it is ... You are creating a new memoized function and executing it every time that scale
is called. You should make that function a standalone function (created once, not on every execution) and then it will work as you expect.
That sounds rather obvious.. these getters tied my brain into a knot. Thanks for the help x)
I have the following code
Even though the arguments are the same, the createScale function is still called twice, thus returning different instances of Scale. Any ideas? Is this specific to ES6 class getters?