graphql-platform icon indicating copy to clipboard operation
graphql-platform copied to clipboard

Strawberry shake: Expose a bindable Loading property on a generated razor component

Open koenbeuk opened this issue 3 years ago • 1 comments

Is your feature request related to a problem?

While combining AntBlazors table component with a generated strawberry razor component, I ran into the issue of not being able to properly forward when the table is reloading (e.g. due to different sorting/filtering/pagination).

<GetPopularPackagesRenderer Query="@_query">
    <Content Context="data">
        <input bind-Value="_query" />
        <MyCustomComponent Loading="??"></MyCustomComponent>
    </Content>
    <Loading>
        <h1>Loading...</h1>
    </Loading>
</GetPopularPackagesRenderer>

@code {
    string _query;
}

When _query changes, GetPopularPackagesRenderer fetches new data from the server. While this is happening, I would like to stay in the Loading state while being able to inform there that a new Load is taking place.

The solution you'd like

Expose Loading as a bindable property so that I can inform the downstream components that loading is going on. The above would then look something like the following:

<GetPopularPackagesRenderer Query="@_query" bind-Loading="_loading">
    <Content Context="data">
        <input bind-Value="_query" />
        <MyCustomComponent Loading="@_loading"></MyCustomComponent>
    </Content>
    <Loading>
        <h1>Initial loading...</h1>
    </Loading>
</GetPopularPackagesRenderer>

@code {
    bool _loading;
    string _query;
}

Product

Strawberry Shake

koenbeuk avatar Apr 06 '22 21:04 koenbeuk

We are working on this ... I experimented with this already in the newest 13 previews. It will need a couple more iterations.

michaelstaib avatar Jun 13 '22 06:06 michaelstaib