torhovland / blazor-redux Goto Github PK
View Code? Open in Web Editor NEWConnecting a Redux state store with Blazor.
License: Other
Connecting a Redux state store with Blazor.
License: Other
Hi,
Is there any plan to update the package to compatible with new released Blazor Version?
That is very useful tool for Blazor App. Thanks
builder.Services.AddReduxStore<MyState, IAction>(new MyState(), Reducers.RootReducer);
Visual Studio Enterprise 15.7 Preview 3.0
NU1101: Unable to find package Microsoft.AspNetCore.SpaServices.Extensions. No packages exist with this id in source(s): https://dotnet.myget.org/f/blazor-dev/api/v3/index.json
NuGet package restore failed. Please see Error List window for detailed warnings and errors.
1>------ Build started: Project: BlazorRedux, Configuration: Debug Any CPU ------
2>------ Build started: Project: BlazorHosted.Shared, Configuration: Debug Any CPU ------
1>BlazorRedux -> C:\Users\Xperi\Dev\GitHub\blazor-redux\src\BlazorRedux\bin\Debug\netstandard2.0\BlazorRedux.dll
3>------ Build started: Project: FSharpLib, Configuration: Debug Any CPU ------
4>------ Build started: Project: BlazorStandalone, Configuration: Debug Any CPU ------
2>BlazorHosted.Shared -> C:\Users\Xperi\Dev\GitHub\blazor-redux\samples\BlazorHosted\BlazorHosted.Shared\bin\Debug\netstandard2.0\BlazorHosted.Shared.dll
5>------ Build started: Project: BlazorHosted.Client, Configuration: Debug Any CPU ------
3>C:\Users\Xperi\Dev\GitHub\blazor-redux\samples\FSharp\FSharpLib\FSharpLib.fsproj : error NU1101: Unable to find package TaskBuilder.fs. No packages exist with this id in source(s): https://dotnet.myget.org/f/blazor-dev/api/v3/index.json
3>C:\Users\Xperi\Dev\GitHub\blazor-redux\samples\FSharp\FSharpLib\Library.fs(37,25): error FS0039: The namespace 'Tasks' is not defined.
3>C:\Users\Xperi\Dev\GitHub\blazor-redux\samples\FSharp\FSharpLib\Library.fs(41,9): error FS0039: The value or constructor 'task' is not defined.
3>Done building project "FSharpLib.fsproj" -- FAILED.
6>------ Build started: Project: FSharp (FSharp\FSharp), Configuration: Debug Any CPU ------
6>C:\Users\Xperi\Dev\GitHub\blazor-redux\samples\FSharp\FSharp\FSharp.csproj : error NU1101: Unable to find package TaskBuilder.fs. No packages exist with this id in source(s): https://dotnet.myget.org/f/blazor-dev/api/v3/index.json
6>CSC : error CS0006: Metadata file 'C:\Users\Xperi\Dev\GitHub\blazor-redux\samples\FSharp\FSharpLib\bin\Debug\netstandard2.0\FSharpLib.dll' could not be found
6>Done building project "FSharp.csproj" -- FAILED.
4>BlazorStandalone -> C:\Users\Xperi\Dev\GitHub\blazor-redux\samples\BlazorStandalone\bin\Debug\netstandard2.0\BlazorStandalone.dll
4>Processing embedded resource linker descriptor: mscorlib.xml
4>Output action: Link assembly: BlazorStandalone, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
4>Output action: Copy assembly: BlazorRedux, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
4>Output action: Copy assembly: Microsoft.Extensions.DependencyInjection.Abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
4>Output action: Copy assembly: Microsoft.Extensions.DependencyInjection, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
4>Output action: Copy assembly: Microsoft.AspNetCore.Blazor.Browser, Version=0.2.0.0, Culture=neutral, PublicKeyToken=null
4>Output action: Copy assembly: Microsoft.AspNetCore.Blazor, Version=0.2.0.0, Culture=neutral, PublicKeyToken=null
4>Output action: Link assembly: netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51
4>Output action: Link assembly: mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
4>Output action: Link assembly: System.Core, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
4>Output action: Link assembly: System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
4>Output action: Delete assembly: System.Data, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
4>Output action: Link assembly: System.Diagnostics.StackTrace, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
4>Output action: Delete assembly: System.Drawing, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
4>Output action: Link assembly: System.Globalization.Extensions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
4>Output action: Delete assembly: System.IO.Compression, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
4>Output action: Delete assembly: System.IO.Compression.FileSystem, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
4>Output action: Delete assembly: System.ComponentModel.Composition, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
4>Output action: Link assembly: System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
4>Output action: Delete assembly: System.Numerics, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
4>Output action: Delete assembly: System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
4>Output action: Delete assembly: System.Runtime.Serialization.Xml, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
4>Output action: Link assembly: System.Runtime.Serialization.Primitives, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
4>Output action: Link assembly: System.Security.Cryptography.Algorithms, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
4>Output action: Delete assembly: System.Security.SecureString, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
4>Output action: Delete assembly: System.Transactions, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
4>Output action: Delete assembly: System.Web.Services, Version=2.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
4>Output action: Delete assembly: System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e
4>Output action: Delete assembly: System.Xml.Linq, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
4>Output action: Delete assembly: System.Xml.XPath.XDocument, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
4>Output action: Delete assembly: Mono.Security, Version=2.0.5.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756
4>Output action: Delete assembly: System.ServiceModel.Internals, Version=0.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
4>Writing index to: C:\Users\Xperi\Dev\GitHub\blazor-redux\samples\BlazorStandalone\obj\Debug\netstandard2.0\blazor\index.html
4>Blazor Build result -> 22 files in C:\Users\Xperi\Dev\GitHub\blazor-redux\samples\BlazorStandalone\bin\Debug\netstandard2.0\dist
5>BlazorHosted.Client -> C:\Users\Xperi\Dev\GitHub\blazor-redux\samples\BlazorHosted\BlazorHosted.Client\bin\Debug\netstandard2.0\BlazorHosted.Client.dll
5>Blazor Build result -> 23 files in C:\Users\Xperi\Dev\GitHub\blazor-redux\samples\BlazorHosted\BlazorHosted.Client\bin\Debug\netstandard2.0\dist
7>------ Build started: Project: BlazorHosted.Server, Configuration: Debug Any CPU ------
7>C:\Users\Xperi\Dev\GitHub\blazor-redux\samples\BlazorHosted\BlazorHosted.Server\BlazorHosted.Server.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.SpaServices.Extensions. No packages exist with this id in source(s): https://dotnet.myget.org/f/blazor-dev/api/v3/index.json
7>BlazorHosted.Server -> C:\Users\Xperi\Dev\GitHub\blazor-redux\samples\BlazorHosted\BlazorHosted.Server\bin\Debug\netcoreapp2.0\BlazorHosted.Server.dll
7>Done building project "BlazorHosted.Server.csproj" -- FAILED.
========== Build: 4 succeeded, 3 failed, 0 up-to-date, 0 skipped ==========
I have been using Redux in React for a while now. In my C# code I consider a switch statement a code smell. I know they use them Redux but that is JavaScript.
I also use the MeditaR pattern from Jimmy Bogard on all my .net core web apps. I did a quick google search for MediatR Redux and found:
https://github.com/sstorie/MediatRedux/tree/master/src/MediatRedux
His concerns are the same as mine. also this would give a pipeline for extention simply using MediatRs abilities. Would like your thoughts.
Thanks for the great work.
When building with the latest Blazor-Redux 0.0.4, I get the following:
Program.cs(17,25): error CS7036: There is no argument given that corresponds to the required formal parameter 'getLocation' of 'Store<MyModel, MyMsg>.Store(Reducer<MyModel, MyMsg>, Reducer<MyModel, LocationAction>, Func<MyModel, string>, MyModel)' [/Users/ryan/Code/trail/sample/blazor-redux-standalone/BlazorReduxApp/BlazorReduxApp.csproj]
Is a Location
property now required, or am I reading this error incorrectly?
There seems to be a compile time issue if upgrading Blazor to version 0.5.0 if using blazor-redux. I have tried both upgrading my existing project and referencing blazor-redux in a new example project with Blazor 0.5.0 (that run before referencing).
Error MSB3073 The command "dotnet "C:\Users\wroom\.nuget\packages\microsoft.aspnetcore.blazor.build\0.5.0\targets\../tools/illink/illink.dll" -l none -c link -u link -b true -t --verbose -d "C:\Users\wroom\.nuget\packages\microsoft.aspnetcore.blazor.build\0.5.0\targets\../tools/mono/bcl/" -d "C:\Users\wroom\.nuget\packages\microsoft.aspnetcore.blazor.build\0.5.0\targets\../tools/mono/bcl/Facades/" -o "c:\users\wroom\Source\WebApplication2\obj\Debug\netstandard2.0\blazor/linker/" -x "C:\Users\wroom\.nuget\packages\microsoft.aspnetcore.blazor.build\0.5.0\targets\BuiltInBclLinkerDescriptor.xml" -x "c:\users\wroom\Source\WebApplication2\obj\Debug\netstandard2.0\blazor\linker.descriptor.xml" -a "C:\Users\wroom\.nuget\packages\blazor-redux\0.0.5\lib\netstandard2.0\BlazorRedux.dll" -a "C:\Users\wroom\.nuget\packages\microsoft.aspnetcore.blazor\0.5.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.dll" -a "C:\Users\wroom\.nuget\packages\microsoft.aspnetcore.blazor.browser\0.5.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.Browser.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.extensions.dependencyinjection\2.1.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll" -a "C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.extensions.dependencyinjection.abstractions\2.1.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" -a "C:\Users\wroom\.nuget\packages\microsoft.jsinterop\0.5.0\lib\netstandard2.0\Microsoft.JSInterop.dll" -a "C:\Users\wroom\.nuget\packages\mono.webassembly.interop\0.5.0\lib\netstandard2.0\Mono.WebAssembly.Interop.dll" -a "c:\users\wroom\Source\WebApplication2\obj\Debug\netstandard2.0\WebApplication2.dll"" exited with code 1. WebApplication2 C:\Users\wroom\.nuget\packages\microsoft.aspnetcore.blazor.build\0.5.0\targets\Blazor.MonoRuntime.targets 441
Hi @torhovland
I was wondering about your decision to put an aync call in https://github.com/torhovland/blazor-redux/blob/master/samples/BlazorStandalone/ActionCreators.cs ?
In redux, I would most likely use something like redux-saga to implement an async action. While I understand that adding the concept of sagas might be overkill, do you think there might be another location to place the async calls while keeping ActionCreator pure?
@torhovland can you please create new release tag and publish latest nuget package to https://www.nuget.org/packages/Blazor-Redux/?
Thanks!
I created a ASP.Net Core 2.1 Hosted template from VS then added the BlazorRedux package to the Client project and built it. This produced the below error. The sdk version is "2.1.300-preview2-008533" and all blazor packages are on 0.2.0
Error MSB3073 The command "dotnet "C:\Users\cmayberry.nuget\packages\microsoft.aspnetcore.blazor.build\0.2.0\targets../tools/illink/illink.dll" -c link -u link -t --verbose -d "C:\Users\cmayberry.nuget\packages\microsoft.aspnetcore.blazor.build\0.2.0\targets../tools/mono/bcl/" -d "C:\Users\cmayberry.nuget\packages\microsoft.aspnetcore.blazor.build\0.2.0\targets../tools/mono/bcl/Facades/" -o "C:\Users\cmayberry\source\repos\BlazorTest2\BlazorTest2\BlazorTest2.Client\obj\Debug\netstandard2.0\blazor/linker/" -x "C:\Users\cmayberry.nuget\packages\microsoft.aspnetcore.blazor.build\0.2.0\targets\BuiltInBclLinkerDescriptor.xml" -x "C:\Users\cmayberry\source\repos\BlazorTest2\BlazorTest2\BlazorTest2.Client\obj\Debug\netstandard2.0\blazor\linker.descriptor.xml" -a "C:\Users\cmayberry.nuget\packages\blazor-redux\0.0.3\lib\netstandard2.0\BlazorRedux.dll" -a "C:\Users\cmayberry.nuget\packages\microsoft.aspnetcore.blazor\0.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.dll" -a "C:\Users\cmayberry.nuget\packages\microsoft.aspnetcore.blazor.browser\0.2.0\lib\netstandard2.0\Microsoft.AspNetCore.Blazor.Browser.dll" -a "C:\Users\cmayberry.nuget\packages\microsoft.extensions.dependencyinjection\2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.dll" -a "C:\Users\cmayberry.nuget\packages\microsoft.extensions.dependencyinjection.abstractions\2.0.0\lib\netstandard2.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" -a "C:\Users\cmayberry\source\repos\BlazorTest2\BlazorTest2\BlazorTest2.Shared\bin\Debug\netstandard2.0\BlazorTest2.Shared.dll" -a "C:\Users\cmayberry\source\repos\BlazorTest2\BlazorTest2\BlazorTest2.Client\obj\Debug\netstandard2.0\BlazorTest2.Client.dll"" exited with code 1. BlazorTest2.Client C:\Users\cmayberry.nuget\packages\microsoft.aspnetcore.blazor.build\0.2.0\targets\Blazor.MonoRuntime.targets 435
I always got the following error:
Error: System.ArgumentException: The assembly 'blazor.redux' does not contain a public invokable method with [JSInvokableAttribute("DevToolsReady")].
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.GetCachedMethodInfo (Microsoft.JSInterop.Infrastructure.DotNetDispatcher+AssemblyKey assemblyKey, System.String methodIdentifier) <0x24f0eb8 + 0x000dc> in <8e638f8fc2b74908b7ce028347321a9b>:0
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously (Microsoft.JSInterop.JSRuntime jsRuntime, Microsoft.JSInterop.Infrastructure.DotNetInvocationInfo& callInfo, Microsoft.JSInterop.Infrastructure.IDotNetObjectReference objectReference, System.String argsJson) <0x24f0830 + 0x0003a> in <8e638f8fc2b74908b7ce028347321a9b>:0
at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet (Microsoft.JSInterop.JSRuntime jsRuntime, Microsoft.JSInterop.Infrastructure.DotNetInvocationInfo invocationInfo, System.String argsJson) <0x24f03a0 + 0x00094> in <8e638f8fc2b74908b7ce028347321a9b>:0
Could you help me?
so server-side Blazor apps do not share the same store across clients.
I want to avoid using inheritance (@inherits MyAppComponent) because my pages and components often already use inheritance. (Plus we favor composition anyway right?)
Most of my pages inherit from class that inherits from BlazorComponent. Containing all the page/view functions, similar to a code-behind class in regular ASP.NET as recommended here.
I tried injecting and just instantiating the MyAppComponent(), neither works. Perhaps I'm missing something obvious @torhovland?
Hi,
In react/redux I use Redux Logger to log the actions to console in development. I was wondering if you have a plan to allow middleware or maybe just build logging to the console directly into Blazor-Redux?
PS - I am happy to help with the logging or other pieces.
Chanan
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.