Code Monkey home page Code Monkey logo

stl.fusion.pagestateservice's Introduction

Proof of concept extracting private Blazor component into a Circuit/Session bound Compute service powered by Stl.Fusion.

See the updates to sample project Blazorise.

Goals

  • End-to-end Real Time, from database to multiple hosts and multiple Blazor clients; thanks to Fusion.
  • Isolation of UI state and update logic into an live/observable model.
  • The PageState fusion service serves up an immutable object that can efficiently be rendered through fusion LiveComponents. Child components can check for reference equality of state child nodes passed to them as parameters
  • Efficient rendering without the need to implement Blazor's ShouldComponentRender nor to strategically call StateHasChanged.
  • This translates to good scalability of complex user interfaces. All components can be simple, 'Pure'; free of complex code and side-effects or inter-component rendering dependencies. All logic is testable and delegated away into the Actions in the stores.
  • Testing the stores is a good substitute for testing the actual Blazor components and much easier.

Done:

  • TodoPageState contains the client-side state for the todo page, such as current page size and page marker.
  • The state is owned by the TodoPageStateService. It manipulates the state through Commands, such as LoadMore. This in turn depends on the TodoService for live requerying.
  • Started extracted the logic from the todopage.razor, making it a render-only component

Issues and Todos:

  1. The state in TodoPageStateService behaves as ServiceLifetime.Transient and is reset after each request, even though the service is marked as ServiceLifetime.Scoped here as per MS Docs. Due to this bug the state (including current PageSize) is lost on every request and hence loading more pages does not work.
  2. Finish extracting all logic and commands in todopage.razor and todoitem.razor
  3. Testers still to be implemented.

stl.fusion.pagestateservice's People

Contributors

alexyakunin avatar dependabot-preview[bot] avatar hypercodeplace avatar leonardo-ferreira avatar pintrarakha-st avatar riesvriend avatar themodem avatar tyrrrz avatar

Watchers

 avatar

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.