Skip to content
This repository was archived by the owner on Mar 1, 2024. It is now read-only.
This repository was archived by the owner on Mar 1, 2024. It is now read-only.

add "Alternative" operator into query DSL #201

@mattiamanzati

Description

@mattiamanzati

Imagine a scenario where you have 2 different queries, and those queryies take 2 different times to resolve.
A real world scenario would be having the same query which one fetches from a local storage, and one fetches from a REST api.

Those 2 queries have the same signature (userId: string) => User, and I would love to compose them so that if the first one is pending or returned an error, the result of the second one is returned.
Something along the lines of:

const userQuery = alternative(userFromRestQuery, userFromLocalStorageQuery)

and the behaviour of alternative would be the same as https://github.com/devex-web-frontend/remote-data-ts/blob/master/src/remote-data.ts#L408

Thanks again for the great library!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions