Skip to content

Investigate separating state from components in the web-components #275

@alexgarel

Description

@alexgarel

Right now the web-components mix rendering logic and state.
Most importantly, we use a mix of signals, dom reaching, to propagate state and it's quite messy (no clear pattern).
Also we also rely a lot on mixins which is sometimes hard to follow (composition can be better).

Investigate the use of https://www.npmjs.com/package/@lit-app/state to handle states.
Use @lit-lab/signals to handle states, as done for https://github.com/openfoodfacts/openfoodfacts-webcomponents/

We could have some state objects, like the search (query / result), the facets and each facets, etc.

Those states have to be handled by "search_name". Each state lives in it's own module and a get_xxx_state(search_name) function exist in each, it handle the fact that if search_name is null or '', it means "search-a-licious" (default name)

State objects have the advantage that they handle state propagation by themselves, so it could be really a good help.

It is best done in conjuction with #282

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Backlog (ready for dev)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions