abpframework / abp

Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
https://abp.io
GNU Lesser General Public License v3.0
12.87k stars 3.43k forks source link

Blazor Full-Stack Web App UI Option #18289

Closed hikalkan closed 7 months ago

hikalkan commented 10 months ago

We will work on this in this milestone to see if we can create an option on new solution creation.

khalilsheikh commented 10 months ago

feature will also include authentication razor pages (login, forgot password etc.) into blazor project ?

hikalkan commented 10 months ago

feature will also include authentication razor pages (login, forgot password etc.) into blazor project ?

We think to reuse the account module. So, it includes all these.

bxjg1987 commented 10 months ago

It seems that the blazer web app can replace the previous mvc/blazer server/assembly. Should those templates still be retained.

sturlath commented 10 months ago

Can you try to stick with SSR as much as possible and try out something like HTMX instead of doing interactive server rendering mode (needing socket/SignalR)? Fast and scalable should be the goal.

maliming commented 9 months ago

I started to study this new feature today.

bxjg1987 commented 9 months ago

I started to study this new feature today.

Would you consider the coexistence of server and auto rendering modes.

In this way, within the same project, some pages or components are allowed to run in server rendering mode, while others run in auto mode.

Reference: https://www.cnblogs.com/jionsoft/p/17880805.html http://zlj.cqyuzuji.com:19911/ https://www.bilibili.com/video/BV1Me411z7eN/?spm_id_from=333.337.search-card.all.click

gdunit commented 9 months ago

@maliming I made an initial attempt at doing this to see what it might look like, starting from the Blazor Server template then modifying it to a Blazor web app per the Microsoft upgrade instructions.

My use case is to use SSR for the initial load, then switch to WASM for most components once that runtime is loaded.

I only got part-way so far but here is what I learned, in case it helps you:

Apart from the above, so far, it seems to work - although it is just a basic test.

Happy to provide more information if it helps at all.

maliming commented 9 months ago

Thank you very much @gdunit
Your information is very helpful.

johnnypea commented 8 months ago

@gdunit thanks for sharing your approach. Do you have any working examples?

gdunit commented 8 months ago

@johnnypea I'll find some time to pull out what I've done and put up a repo. It's messy and not fully working, but hopefully gives a starting point.

gdunit commented 8 months ago

@johnnypea So here you go: Repo link

I did a lot of experimenting so please expect things to be quite untidy. It is by no means finished, I stopped work as I know there is an officially supported version coming in 8.2.

On the home page, you will see a link to the counter component. This initialises using SSR but then moves to WASM, there is an element in the UI that shows the transition.

Issues:

Interested to hear any thoughts or feedback.

diegompimenta commented 7 months ago

Hi guys! Thanks for all your work on this and congratulations for this progress! @johnnypea @hikalkan @maliming One question, Abp on this template will support sharing access token between a page SSR and a form component in Wasm? Example: I have a page SSR with the user logged in and just one form in WASM. When i submit this form the user will create a product posting on API right? How it will work to map the API on this template? The token of user authenticated is on the site/ssr. How it will work? It makes sense or the context for SSR and WASM will be separated? How the application will handle authentication and token between these different contexts/modes? Thanks again!

maliming commented 7 months ago

hi

One question, Abp on this template will support sharing access token between a page SSR and a form component in Wasm?

Yes.

https://github.com/abpframework/abp/blob/blazor-full-stack-web-ui/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered/Components/App.razor#L65-L94

https://github.com/abpframework/abp/blob/blazor-full-stack-web-ui/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Blazor.WebApp.Tiered.Client/MyProjectNameBlazorClientModule.cs#L81C26-L81C55

https://github.com/abpframework/abp/blob/blazor-full-stack-web-ui/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/WebAssembly/WebApp/PersistentComponentStateAbpAccessTokenProvider.cs#L7-L32