GithubHelp home page GithubHelp logo

smapiot / piral.blazor Goto Github PK

View Code? Open in Web Editor NEW
54.0 9.0 16.0 1.59 MB

All .NET things to make Blazor work seamlessly in microfrontends using Piral. :jigsaw:

Home Page: https://piral.io

License: MIT License

C# 71.22% HTML 5.94% TypeScript 20.90% JavaScript 0.38% SCSS 1.32% PowerShell 0.05% Shell 0.05% CSS 0.14%
piral blazor aspnet-core webassembly microfrontends spa plugin hacktoberfest

piral.blazor's People

Contributors

daniel-rck avatar dantederuwe avatar david-najar avatar dependabot[bot] avatar florianrappl avatar johannesehrhart avatar luckyluggi avatar prepfarm avatar software-programmer avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

piral.blazor's Issues

Calling StateHasChanged() does not reload Page and Extension Components

Bug Report

For more information, see the CONTRIBUTING guide.

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version?
  • Did you perform a search in the issues?

Environment Details and Version

[Package Version, Blazor Version, OS, Browser,...]

Description

Hy. I've been tracking down a problem in my app and i think i've found the source of the problem now.
I have created this mvp to show the problem:
https://github.com/luckyluggi/-mvp_piral_statehaschanged

There i have a StateContainer (my-pilet\State\ShoppingCartState.cs) with Items.
Whenever i add items i call StateHasChanged() in my-pilet\Pages\ShopPage.razor and my-pilet\Components\ShoppingCartIcon.razor but the state does not get updated.

Steps to Reproduce

see mvp

Expected behavior

Component should reload and show new state

Actual behavior

does not reload

Possible Origin / Solution

[Optionally, share your idea to fix the issue]

Support Satellite Assemblies

New Feature Proposal

For more information, see the CONTRIBUTING guide.

Description

Right now satellite assemblies used for localizations are not picked up. They should be.

Background

Most users will actually use the localization system from .NET (https://learn.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-7.0&pivots=webassembly). This way, multiple satellite assemblies will be created - depending on the provided localization resources.

Discussion

How should the language be changed? The main idea would be that this would / could work implicitly, but the behavior could also be determined when configuring piral-blazor. For standalone pilets a dedicated API to configure / change this would be provided.

Integrate Into Publish from Visual Studio

New Feature Proposal

For more information, see the CONTRIBUTING guide.

Description

Right now pilets are published by opening a terminal and changing directory to the scaffolded folder of a pilet. Then, the npx pilet command has to be used with the publish subcommand to trigger the publishing.

This should be simplified.

Background

It should be possible to just publish a pilet without any terminal interaction at all.

Discussion

Right now we want to automatically have the publishing provider adjusted to make this just work nicely. Two options exist:

  1. Somewhat introduce a new provider, which might not be easy and would require a VS extension. https://learn.microsoft.com/en-us/visualstudio/deployment/deploying-applications-services-and-components-resources?view=vs-2022
  2. Just make a post publish command; https://social.msdn.microsoft.com/Forums/vstudio/en-US/e5c7114d-e465-4a46-a4e1-3850c578400e/how-do-i-add-a-custom-command-to-the-publish-process-for-a-web-project?forum=msbuild - this would be part of Piral.Blazor.Tools and it would take (optional) input such as the API key (otherwise, interactive would be used anyway, opening a web browser to authenticate) or the feed URL to publish.

(The second way has the benefit that it would automatically also work with dotnet publish.)

Urls build with IPiletService.GetUrl() are not correct.

Bug Report

For more information, see the CONTRIBUTING guide.

Prerequisites

  • [ x] Can you reproduce the problem in a MWE?
  • [ x] Are you running the latest version?
  • [ x] Did you perform a search in the issues?

Environment Details and Version

[Package Version, Blazor Version, OS, Browser,...]

Description

Image loaded from wwwroot via IPiletService.GetUrl() are not found.
I've reproduced the bug here:
https://github.com/luckyluggi/piral_extensions_and_aimages

Steps to Reproduce

  1. [First Step]
  2. [next step...]

Expected behavior

[What you expected to happen]

Actual behavior

[What actually happened]

Possible Origin / Solution

[Optionally, share your idea to fix the issue]

Support for .NET 7

New Feature Proposal

For more information, see the CONTRIBUTING guide.

Description

Now that .NET 7 / Blazor 7 is officially released we should also have a blazor-7.0 branch with an associated release.

Background

One of the things with .NET 7 is that Blazor now has a stable custom elements API - which would be another capability for Piral.Blazor. Using .NET 7 we would not need the DOM projection any more, but instead of web components. Otherwise, it's still the same as .NET 6.

Discussion

Anything else in Blazor 7 that is of particular interest for Piral / would make our live here easier / better?

Pilets should be able to add to App.razor

New Feature Proposal

For more information, see the CONTRIBUTING guide.

Description

Currently the App. razor file is locked away and has to be taken as it is.
If f.e. Microsoft.AspNetCore.Components.Authorization should be used The App.razor must be edited like this:

<CascadingAuthenticationState>
    <Router ...>
        <Found ...>
            <AuthorizeRouteView RouteData="@routeData" 
                DefaultLayout="@typeof(MainLayout)" />
        </Found>
        <NotFound>
            <LayoutView ...>
                ...
            </LayoutView>
        </NotFound>
    </Router>
</CascadingAuthenticationState>

This should be possible.

Background

[Provide any additional background for the feature, e.g., why is the current solution insufficient, what problem will it solve, etc.]

Discussion

[Optionally, outline any pros and cons you can currently think of to provide the basis for a solid discussion]

If the [PiralComponent] attribute is added to a base component it should also be inherited.

New Feature Proposal

For more information, see the CONTRIBUTING guide.

Description

See an example here (Problem nr. 2 in the Readme.md file):
https://github.com/luckyluggi/piral_meeting_examples

Background

[Provide any additional background for the feature, e.g., why is the current solution insufficient, what problem will it solve, etc.]

Discussion

[Optionally, outline any pros and cons you can currently think of to provide the basis for a solid discussion]

Scaffolding check always passing

Related to PR #38

afaik the _piletFolderPath already has the MSBuildProjectName included, so it should already be considered when scaffolding. This being merged now includes the project name twice (e.g. piral~/projectname/projectname) and results in the scaffold always happening.

Originally posted by @DanteDeRuwe in #38 (comment)

Reposted here to get opinion of @FlorianRappl about this

NavLink active class does not get updated and NavigationManager.LocationChanged is not called.

Bug Report

For more information, see the CONTRIBUTING guide.

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version?
  • Did you perform a search in the issues?

Description

If you switch Change Routes in the app the active class in Components is not updated.
Also NavigationManager.LocationChanged does not get called.

Steps to Reproduce

I Have created an MVP to make this clearer.
https://github.com/luckyluggi/mvp_route_update

Add possibility to configure ILogger

New Feature Proposal

For more information, see the CONTRIBUTING guide.

Description

Since the ILogger is configured in piral core we currently can not configure it. We need a possibility to do that.

Background

[Provide any additional background for the feature, e.g., why is the current solution insufficient, what problem will it solve, etc.]

Discussion

[Optionally, outline any pros and cons you can currently think of to provide the basis for a solid discussion]

Piral.Blazor 5 (and 6..)

Currently version 3.2.1 is released, 5 is in prerelease and there isn't anything for dotnet6 blazor. Will eventually 5 and 6 be released?
By the way, amazing work!

Allow Forwarding Requests to Kras Proxy

New Feature Proposal

For more information, see the CONTRIBUTING guide.

Description

Right now the Kras proxy cannot be configured / used with the Piral.Blazor.DevServer. This should be changed

Background

One of the reasons is that we don't forward non-pilet requests to the Kras proxy. As a mitigation, the Kras proxy scripts should be placed (configurably) in some directory, with the kras config being read and all proxy-endpoints being forwarded properly.

Discussion

I think a good starting point would be the definition of the mocks directory (e.g., <MocksDir>mocks</Mocks>), which might contain a .krasrc file and other files. The .krasrc file would then be merged / brought over to the pilet, with the scripts being referenced / used directly. The keys of the map property will be used as forwarding endpoints.

The Browser Window does a hard reload when navigating to an upper route.

Bug Report

For more information, see the CONTRIBUTING guide.

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version?
  • Did you perform a search in the issues?

Environment Details and Version

[Package Version, Blazor Version, OS, Browser,...]

Description

I've created an mvp showing the problem:
https://github.com/luckyluggi/mvp_route_reload

When you enter the root Page you can switch between all pages using the buttons at the top like it should be. In this case <base href="http://localhost:1234/"> is set in the .

But if you go to http://localhost:1234/winter/posts and press F5 -> <base href="http://localhost:1234/winter/posts"> gets written into the <head>. Now you can switch between all /winter/-Pages like it should be, but as soon as you switch to a /summer/-Page the browser window reloads.

I belive it has something to do with the <base>.

Steps to Reproduce

  1. [First Step]
  2. [next step...]

Expected behavior

[What you expected to happen]

Actual behavior

[What actually happened]

Possible Origin / Solution

[Optionally, share your idea to fix the issue]

piralVersion is not defined

In case the core dependencies are not found, e.g.,

Piral Blazor was not found in the Piral Instance, and the needed dependencies are also not found. Installing them now...

it may throw an error

(node:12052) UnhandledPromiseRejectionWarning: ReferenceError: piralVersion is not defined

This should be fixed in blazor.codegen. ("the error is throwing from the line blazor.codegen:276:77")

Components with the [PiralComponent] attribute should support adding @typeparam

Bug Report

For more information, see the CONTRIBUTING guide.

Prerequisites

  • [ x] Can you reproduce the problem in a MWE?
  • [ x] Are you running the latest version?
  • [ x] Did you perform a search in the issues?

Environment Details and Version

[Package Version, Blazor Version, OS, Browser,...]

Description

See an example here (Problem nr. 1 in the Readme.md file):
https://github.com/luckyluggi/piral_meeting_examples

Steps to Reproduce

  1. [First Step]
  2. [next step...]

Expected behavior

[What you expected to happen]

Actual behavior

[What actually happened]

Possible Origin / Solution

[Optionally, share your idea to fix the issue]

Support Global Dependency Injection in Shared Libraries

Right now the DI works only partially. Full DI (i.e., pilet-local specified dependencies) can be fully injected in a pilet (i.e., components within the pilet), however, for components coming from other DLLs this is not working.

In general it is very difficult (almost impossible) to reliably inject the right dependencies in such components. While we could track the happy path (i.e., Component from pilet -> Component from library) and therefore use the right service container, the problem becomes much more difficult when there are interruptions along the way. (i.e., Component from pilet 1 -> async waiting; Component from pilet 2 -> done; async waiting over -> Component from library => which service container would we choose now? last rendering indicates pilet 2, but the actual path / rendering origin was originating from pilet 1).

What we therefore want to do is to enable the global shared dependencies (i.e., obtained from the ConfigureShared method, not ConfigureServices in Module.cs) to be used here. The advantage is that in this case we do not need to track the origin - it would just work and be in this case reliable.

Use .Net/Blazor package version for the pilet

The Blazor pilet seems to remain at 1.0.0, but it should be synced with the version defined in the .NET project. This way, there is no need to touch the contents of the package.json or override them.

Avoid Allowing Referencing Piral.Blazor.Core

Right now when somebody starts a new Piral.Blazor pilet without the template one may be tempted to just reference Piral.Blazor.Core (instead of the usually wanted Piral.Blazor.Utils). Since Piral.Blazor.Core is an application and only meant as a carrier for the shared dependencies we should be very explicit to discourage this.

Ideally, the referencing does not work (how?). In the worst case we just show some warning or info in Visual Studio.

Whatever we do, we should not impact the NuGet experience for piral-blazor, which downloads and unzips the package to get / use the content.

Configure the order for pilets to load.

New Feature Proposal

For more information, see the CONTRIBUTING guide.

Description

Our project has y Layout pilet which configures services (in ConfigureShared) needed by every other pilet.
For that to work wee need it to be loaded first.

Currently this can not be guaranteed. As discussed we'd need a way to set the pilets priority to load. This priority should be used when running all pilets from the feed, when running one pilet locally and all others from the feed and when running multiple pilets locally.

Background

[Provide any additional background for the feature, e.g., why is the current solution insufficient, what problem will it solve, etc.]

Discussion

[Optionally, outline any pros and cons you can currently think of to provide the basis for a solid discussion]

Scaffolding Issue Prevents Rebuild

Similar to #59 we need to ensure that a failed scaffold (e.g., due to some missing dependency) does not prevent a scaffold in the future.

Right now when the initial scaffold fail (but still created the folder structure) a subsequent scaffold will not touch it. This is sub-optimal.

Ideally, we introduce a flag that also includes all used dependencies, allowing us to determine when we need to upgrade / re-scaffold etc.

Auto run pilet debug when debugging

One of my biggest concerns (still) is that we need to run the debug from VS, but also from the command line (sure this can also be done from within VS, but the thing is that its still 2 commands where it should be just one).

Ideally, there is a way to run a process / command when the IIS express starts.

Maybe someone in the aspnetcore gitter or so knows how / if this works.

Update to Blazor 3.2.1

Piral.Blazor should be adjusted to v3.2.1.

In this process we should start aligning the version numbers. The NuGets coming from this repo should always have the same version (Major, Minor, Patch) as Blazor. Thus anyone interested in a particular version of Blazor only needs to know this version for choosing the right version of Piral.Blazor.

Support @page Directive

The @page directive is used to automatically add pages to the router. Internally, this just adds the [PageAttribute] to the generated class.

Most likely, we could do some "magic" and introduce an auto inclusion of these pages. Potentially, it makes sense to trigger this via piral-blazor (explicitly), such that it could be turned off - if not desired.

export function setup(api) {
  api.defineBlazorReferences([...], {
    includePages: true, //set to false or omit to not auto discover
  });
}

Configuration Values (configured in the feed) should also be available when debugging.

New Feature Proposal

For more information, see the CONTRIBUTING guide.

Description

The possibility to set configs in the feed service is great, but while running pilets locally via pilet debug the configs are currently empty. It would be great if they were also pulled if i add the feed via --feed.
Or even better if they could be configured in a json file just for running and debugging pilets localy.

Background

[Provide any additional background for the feature, e.g., why is the current solution insufficient, what problem will it solve, etc.]

Discussion

[Optionally, outline any pros and cons you can currently think of to provide the basis for a solid discussion]

Add Support for ordering Extensions

New Feature Proposal

For more information, see the CONTRIBUTING guide.

Description

It Should be supported to order Extensions inside Blazor Pilets

In js pilets this is already supported like so:

<piral.Extension 
          name="topbar-left"
          order={(extensions: Array<ExtensionRegistration>) => {
            return extensions.sort((a, b) => {
                if(a.defaults?.order > b.defaults?.order) return 1;
                if(a.defaults?.order < b.defaults?.order) return -1;
                return 0;
            })
          }}
        />

other pilets can then add items like so:

app.registerExtension("topbar-left", () => {
    return <li>First</li>; 
  }, {order: 50});

and even blazor pilets can add items like so:

app.registerExtension('topbar-left', app.fromBlazor('my-extension'),{order: 10});

In Blazor we can create the extension like so:

<Extension name="topbar-left" />

but we currently don't have the possibility to sort the items.

Background

[Provide any additional background for the feature, e.g., why is the current solution insufficient, what problem will it solve, etc.]

Discussion

[Optionally, outline any pros and cons you can currently think of to provide the basis for a solid discussion]

Override "Normal" Routing

For the current model we've introduced the custom Anchor element. Blazor's "primitives" here (just standard a or something like NavLink) should, however, also just work.

So instead, I propose to just override the standard routing behavior. The mechanism should be to use the context's Router instead of the history API. Most likely, this is a change in the piral-blazor code.

Moving to another route using NavigationManager.NavigateTo() is rurrently not possible

Bug Report

For more information, see the CONTRIBUTING guide.

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version?
  • Did you perform a search in the issues?

Environment Details and Version

[Package Version, Blazor Version, OS, Browser,...]

Description

When i want to move to another page programmatically by injecting "Navigationmanager" and calling "_navigationManager.NavigateTo($"/item/create");" the page does not change.
I can ofcourse add true as a second param to bypass client side routing and load the new page from the server, and it does work, but that's not rly nice and slow.

I've added an example page to the mvp (/navigationmanager):
https://github.com/luckyluggi/mvp_piral_route_params

More info on Navigationmanager:
https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.components.navigationmanager.navigateto?view=aspnetcore-6.0

Steps to Reproduce

see mvp

Expected behavior

should move to another route

Actual behavior

does not move to another route

Possible Origin / Solution

[Optionally, share your idea to fix the issue]

Blazor Pilet Debugging - Pull in pilets within configured feed

New Feature Proposal

Would like to have a way to configure a feed to pull other enabled pilets from a configured feed during a specific Blazor pilets debug session. This could potentially be a parameter to somehow pass to Piral.Blazor.DevServer or via the devserver config directly. We see npx pilet debug has a --feed param but we are not able to hook into this as Piral.Blazor.DevServer abstracts the blazor pilet debug process,

image
ref: https://github.com/smapiot/piral/blob/main/docs/commands/debug-pilet.md#--feed

This would allow us to ensure pilets integrate together well during development workflows.

Add overrides for package.json

Right now with the standard template the contents of the actual pilet are pretty much "hidden" for the end-user.

We should add a way (e.g., using a file "overrides.json") to merge in custom settings (should be deep merged, not shallow merged) just like we did with "setup.ts".

Refresh scaffolded pilet

Right now the scaffolded pilet is a bit "too sticky". In order to apply, e.g., an update of the Piral instance / emulator package, you'd need to manually go to the pilet's directory and run pilet upgrade. Sure, this is the "usual" way, however, for a Blazor Pilet (Blazelet?) it should not be necessary. Ideally, this can be done directly from Visual Studio - and even better: it may even be implicit.

We should add at least a task to do that, but maybe even automate it appropriately. Easiest way would be to have something like <PiralInstanceVersion> in the csproj, such that it is (by default set to) "latest" (which auto-checks), but could also be set to anything else (and, e.g., in case of explicit versions may only check if the version match, resulting in an update of the scaffolded pilet, or not).

Support (and Use) Blazor's Assembly Lazy Loading

For the upcoming Blazor / Piral.Blazor 5.0.0 release the new lazy loading of Blazor should be used.

This makes especially sense regarding framework support for larger applications. It should bring an additional layer of reliability, too.

More information can be found:

It should be configurable where the piral~ folder is created

New Feature Proposal

For more information, see the CONTRIBUTING guide.

Description

Currentl the folder is created one directory up. We would like to configure it to be 2 directories up.

Background

[Provide any additional background for the feature, e.g., why is the current solution insufficient, what problem will it solve, etc.]

Discussion

[Optionally, outline any pros and cons you can currently think of to provide the basis for a solid discussion]

Piral should search for dlls using <AssemblyName> if it is set.

Bug Report

For more information, see the CONTRIBUTING guide.

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version?
  • Did you perform a search in the issues?

Environment Details and Version

Latest version of Piral Blazor 6.

Description

Piral does not find referenced packages if they are renamed using <AssemblyName>

Steps to Reproduce

The behavior can be reproduced with this project (Infos in the readme):
https://github.com/luckyluggi/mvp_piral_blazor_extension

Expected behavior

The custom AssemblyName - if given - is used to determine the DLL name.

Actual behavior

No custom name can be used.

Possible Origin / Solution

N/A

Error Starting Blazor

I followed the instructions for setting up a Piral shell and a Blazor Pilet from the template and I'm getting the following error when debugging the Blazor app:

Uncaught RuntimeError: memory access out of boundsUncaught RangeError: Invalid typed array length: 534384Uncaught Error: Failed to start platform. Reason: RangeError: Invalid typed array length: 43920The thread 0x3a84 has exited with code 0 (0x0).

Any idea what I'm doing wrong?

Extension parameter don't work.

Bug Report

For more information, see the CONTRIBUTING guide.

Prerequisites

  • [ x] Can you reproduce the problem in a MWE?
  • [ x] Are you running the latest version?
  • [ x] Did you perform a search in the issues?

Environment Details and Version

[Package Version, Blazor Version, OS, Browser,...]

Description

Parameters given to piral extensions are not working.
I've reproduced the bug here:
https://github.com/luckyluggi/piral_extensions_and_aimages

Steps to Reproduce

  1. [First Step]
  2. [next step...]

Expected behavior

[What you expected to happen]

Actual behavior

[What actually happened]

Possible Origin / Solution

[Optionally, share your idea to fix the issue]

Images from isnide the wwwroot folder can not be referenced.

Bug Report

For more information, see the CONTRIBUTING guide.

Prerequisites

  • Can you reproduce the problem in a MWE?
  • Are you running the latest version?
  • Did you perform a search in the issues?

Environment Details and Version

[Package Version, Blazor Version, OS, Browser,...]

Description

When i try to reference an image from inside the wwwroot folder it is not shown.
Example:

The image does exist in wwwroot/img/logo.png but is not shown.

Steps to Reproduce

  1. [First Step]
  2. [next step...]

Expected behavior

[What you expected to happen]

Actual behavior

[What actually happened]

Possible Origin / Solution

[Optionally, share your idea to fix the issue]

Add Debugging Capability to the Template

Right now the template still needs to be enhanced to allow for more rapid development.

The most important feature is to have the source maps properly working. That means not only debugging in the browser is fine, but also that a breakpoint in VS is triggered properly.

We should check and ensure that this works as expected.

Overridable meta.json for Blazor DevServer

New Feature Proposal

For more information, see the CONTRIBUTING guide.

Description

The meta.json files should be configurable to override some default values in debug environment, similar to packages-override.json.

Background

As far as I understood, you can set default configs via piletConfig, that are overridden by the feed service. When running the Blazor DevServer there is a meta.json that overrides the piletConfig - but I can't define what else should be overriden in local development. Somewhat like

{
    "backendUrl": "http://localhost:7345/"
}

Include script files in referenced packages or RCLs

New Feature Proposal

For more information, see the CONTRIBUTING guide.

Description

In Blazor WASM, it is sometimes necessary to reference static JS assets defined in imported NuGet packages or referenced Razor Class Libraries. One example is Microsoft.Authentication.WebAssembly.Msal, which provides a static script file named AuthenticationService.js which needs to be referenced in the HTML body of wwwroot/index.html like so:

<script src="_content/Microsoft.Authentication.WebAssembly.Msal/AuthenticationService.js"></script>

The same applies to any shared Razor Class Libraries referenced by a pilet, which may also provide static JS files to be used in the same fashion as described above.

Piral.Blazor should support this pattern and provide a way to reference these assets.

Background

As of now, there is no obvious way to reference static JS files within RCLs or NuGet packages from within a Blazor pilet.

Scaffold with NPM v6

Right now our structure requires NPM v7/v8:

The command is the one from the Prial.Blazor.Tools.targets: npx --package=piral-cli -y pilet new $(PiralInstance) --base $(_piletFolderBase) --target $(MSBuildProjectName) --registry $(NpmRegistry) --bundler $(_bundler). the command "new" is not found.

It works with:

npm init pilet --source $(PiralInstance) --base $(_piletFolderBase) --target $(MSBuildProjectName) --registry $(NpmRegistry) --bundler $(_bundler) --defaults

So we'd need to find out the current version and switch command appropriately.

Support `appsettings.*.json` and pass bound `IConfiguration` to `Module.ConfigureServices()`

New Feature Proposal

For more information, see the CONTRIBUTING guide.

Description

Blazor WASM provides a way of providing environment-specific client-side configuration by placing appsettings.*.json files into the wwwroot folder. The active environment can then be set using, for example, a startup configuration as outlined here.

It would be helpful if appsettings.*.json files could be used for client-side app configuration within a Blazor pilet to populate an IConfiguration instance, and if that instance would then be passed to the Module.ConfigureServices method as outlined in the minimal example below.

appsettings.json:

{
  "Api": {
    "BaseUrl": "https://my.api.com/"
  }
}

ApiOptions.cs:

public class ApiOptions
{
  public string? BaseUrl { get; set; }
}

Module.cs:

[...]
  public static void ConfigureServices(IServiceCollection services, IConfiguration configuration)
  {
    services.AddOptions();

    services.Configure<ApiOptions>(options => configuration.Bind("Api", options));
    // or
    services.Configure<ApiOptions>(configuration.GetSection("Api"));
  }
[...]

Background

As of now, IConfiguration is not bound. This leaves the pilet author with hard-coding necessary configuration values within the ConfigureServices method and also neglects the need for environment-specific configuration within pilets.

Blazor Calling Extensions won't pass the Params correctly

In the sample:
https://github.com/smapiot/Piral.Blazor/blob/blazor-5.0/example/pilet/Pilet/Components/SampleExtension.razor

the react-counter is called with params new { count = 10, diff = 3 } however upon loading the page the starting value is 0 and the increment is 1, so the props have the default value.

image

Adding a console.log(params); to the react-counter extension shows that the params is not undefined, but empty and have no properties.
image

So calling Extensions from Blazor with Params, the Params is not correctly passed through.
Calling a Blazor Extension from React works.

Scaffolding on MacOS / nix breaks `blazor.codegen`

When doing this on a non-Windows system the blazor.codegen has slashes (/) everywhere where backslashes ( \) have been used. This breaks the code as regular expressions (and other things) suddenly become invalid syntax.

Support Hot Reload

Please add support for .net6.0 hot reload.

Expected behavior

When i do the following:

  • add "hotReloadProfile": "blazorwasm" in the launchSettings.json like explained here
  • run npm start inside myproject/piral~/my-pilet
  • run dotnet watch inside myproject/my-pilet
  • change something inside the blazor pilet

The Browser should reload and show the changes applied

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.