ChilliCream / ChilliCream/graphql-platform

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

Open
#4,951 1 comment 0 reactions 1 assignee View on GitHub

@michaelstaib is already working on this.

Since Jun 13, 2022.

🌶️ strawberry shake
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.