Skip to content
This repository was archived by the owner on Nov 27, 2022. It is now read-only.
This repository was archived by the owner on Nov 27, 2022. It is now read-only.

Make useLDflex support LDflex paths #15

@RubenVerborgh

Description

@RubenVerborgh

Currently, we can call useLDflex with LDflex strings. For example:

const image = useLDflex('user.image');

However, LDflex paths should also be possible (as is the case with the higher-order-component 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.

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions