Giter Club home page Giter Club logo

blazorrealm's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

nijoseph

blazorrealm's Issues

All Async components refresh not only the one being updated

Hi, I have 3 trees of data that I get from 3 api endpoints and a paged list of data based on criteria selected in the trees. The trees also need to load their branches on demand. When you make a selection criteria in one tree it needs to update the other 2 and reload the paged list.

When I page all 4 components reload, to try to resolve this I split the store to test

services.AddRealmStore(new State1(), Reducers.1RootReducer);
services.AddRealmStore(new State2(), Reducers.2RootReducer);
services.AddRealmStore(new State3(), Reducers.3RootReducer);

1RealmStoreBuilder.UseRealmAsync();
2RealmStoreBuilder.UseRealmAsync();
2RealmStoreBuilder.UseRealmAsync();

This resolved the refresh problem and all panels updated independently however I need to be able to use more than one store in the components.

Do you have any suggestions as to the best way to proceed.

Thanks,

Ian

How to get state in CS file of the Layout?

Layout is inherited from LayoutComponentBase, so it can't be inherited from RealmComponent. What if I want to put some logic in layout's code behind that depends on the state?

This is how I can create conditional HTML using State.

@inherits LayoutComponentBase

<RealmStateContainer TState="WebState" Context="store">
  <ComponentTemplate>
    @{
      WebState State = store.GetState();
      Action<IRealmAction> Dispatch = store.Dispatch;
    }
    @if (State.User == null)
    {
      <LayoutView Layout="@typeof(PublicTemplate)">@Body</LayoutView>
    }
    else
    {
      <LayoutView Layout="@typeof(PrivateTemplate)">@Body</LayoutView>
    }
  </ComponentTemplate>
</RealmStateContainer>

How can I access State in the @code section?

@code 
{
  protected override async Task OnAfterRenderAsync(bool setup)
  {
    if (setup)
    {
      if (State.User == null)   // ???
      {
          navigationManager.NavigateTo("sign-in");
      }
    }
  }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.