Open RubenVerborgh opened 5 years ago
Currently, we can call useLDflex with LDflex strings. For example:
useLDflex
const image = useLDflex('user.image');
However, LDflex paths should also be possible (as is the case with the higher-order-component evaluateExpressions):
evaluateExpressions
const image = useLDflex(solid.data.user.image);
The above will currently not work, because solid.data.user.image will evaluate to a new value every time it is called, triggering infinite rerenders.
solid.data.user.image
This would work:
const promise = solid.data.user.image; function render() { const image = useLDflex(promise); }
but that obviously creates other problems.
What we probably want is a caching feature in LDflex, such that the same paths trigger the same values (until, for instance, the cache is cleared).
Alternatively, LDflex could generate an internal key, and that key is used to conditionally trigger useEffect.
key
useEffect
Currently, we can call
useLDflex
with LDflex strings. For example:However, LDflex paths should also be possible (as is the case with the higher-order-component
evaluateExpressions
):The above will currently not work, because
solid.data.user.image
will evaluate to a new value every time it is called, triggering infinite rerenders.This would work:
but that obviously creates other problems.
What we probably want is a caching feature in LDflex, such that the same paths trigger the same values (until, for instance, the cache is cleared).
Alternatively, LDflex could generate an internal
key
, and thatkey
is used to conditionally triggeruseEffect
.