data-point
data-point copied to clipboard
Pass manager to entity resolve functions
Problem description:
Before passing resolveReducer to entity resolve functions, we bind it to the manager object using _.partial(resolveReducer, manager):
https://github.com/ViacomInc/data-point/blob/master/packages/data-point/lib/entity-types/base-entity/resolve.js#L151
Then, in the resolve for each entity type, we call resolveReducer(accumulator, entity.value) instead of resolveReducer(manager, accumulator, entity.value)
EntityCollection example: https://github.com/ViacomInc/data-point/blob/master/packages/data-point/lib/entity-types/entity-collection/resolve.js#L116
This can be confusing, because resolveReducer is not bound to the manager in other parts of the code, but the function name is the same in either case.
Suggested solution:
Do not use _.partial(resolveReducer, manager) in the base-entity resolve function (which also means we can remove resolveReducerBound = helpers.createReducerResolver(dataPoint) from a lot of the tests, because that also binds the manager to the resolve function).