Open raingerber opened 6 years ago
i have a solution i want to implement in baseentity resolve that would solve this problem
This is one of only two issues left for the v2.x milestone, but it's still a draft. Have we come up with a solution we want to implement?
i have a solution i want to implement in baseentity resolve that would solve this problem
@acatl are you planning to do this one? Maybe you can be assigned?
Problem description:
Transform entities have a
value
property, but they don't have lifecycle methods likeinputType
,before
,after
, andoutputType
:https://github.com/ViacomInc/data-point/blob/master/packages/data-point/lib/entity-types/entity-transform/factory.js#L17
Despite this, transforms are resolved with the same function as other entities, which means they pass through a long promise chain where most of the promises do nothing:
https://github.com/ViacomInc/data-point/blob/master/packages/data-point/lib/entity-types/base-entity/resolve.js#L141
Possible solutions:
Do not resolve transform entities with
resolveEntity
(which would also mean you can't use middleware for transforms).Refactor
resolveEntity
so it does not create promises for nonexistent lifecycle methods (I haven't thought of a great way to do this).Deprecate
transform
entities (or encourage not to use them). They're basically a way to name reducers, but doing this works too:Since this also creates a JS variable, it's possible to use editor tools like jumping from a variable reference to the variable declaration, which is not possible when declaring it like this: