Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization: Multi-fetch standard to decrease request size #1

Open
Rodentman87 opened this issue Apr 12, 2021 · 0 comments
Open

Optimization: Multi-fetch standard to decrease request size #1

Rodentman87 opened this issue Apr 12, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@Rodentman87
Copy link
Owner

This issue is tracking the creation of a standard for a multi-fetch interface, allowing consumers to decrease their outgoing request size by providing a gql query name that implements this standard.

What does the standard look like?

The gql query would take an array of ids and the properties you want for all of them, similar to fetching a single object. This would decrease the amount of duplication that currently exists when fetching a large number of the same object as property names are repeated over and over.

query {
    users([id1, id2, id3...]) {
        id
        name
        ...
    }
}

How would this be implemented in MobQL?

When the DataLoadedList begins the process of requesting the properties from the server, it will find common properties being requested across all the objects in its list. It will then prepare the minimum number of queries to collect all the props needed from the server. For example:

Object 1 is requesting- [name, age, nickname]
Object 2 is requesting- [name, age]

The list will generate:

query {
    a: users([1, 2]) {
        id
        name
        age
    }
    b: users([1]) {
        id
        nickname
    }
}
@Rodentman87 Rodentman87 added the enhancement New feature or request label Apr 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant