Because accessing a property in a callback could reference different values that the ones are available at function definition, we currently do not add property accesses to the inputs array. For example:
function MyComponent({ config }) {
return useAutoMemo(config.value * 2);
}
Gives this output:
function MyComponent({ config }) {
return useMemo(() => config.value * 2, [config]);
}
This is a big issue when dealing with refs, which are a { current } object. Since they are mutable, this makes the problem non-trivial.
Note: the props reference is a special case of this. Since is easier to identify, we should at least treat that some love.
Because accessing a property in a callback could reference different values that the ones are available at function definition, we currently do not add property accesses to the inputs array. For example:
Gives this output:
This is a big issue when dealing with refs, which are a
{ current }object. Since they are mutable, this makes the problem non-trivial.