Blazored / Toast

A JavaScript free toast library for Blazor and Razor Component applications
https://blazored.github.io/Toast/
MIT License
654 stars 90 forks source link

Make Toast Service API work with pure SSR pages (without web socket connection) #254

Closed htmlsplash closed 5 months ago

htmlsplash commented 5 months ago

Is your feature request related to a problem? Please describe. The current toaster service only works with an active Web socket connection (interactive server model).

Describe the solution you'd like Make the IToastService api calls work without web socket connection so it can be invoked on an SSR page.

htmlsplash commented 5 months ago

I guess, looking at the current implementation this is probably not possible without significant re-write since the current implementation relies on a active web socket connection.

chrissainty commented 5 months ago

@htmlsplash This doesn't make a lot of sense. Pure SSR is a non-interactive static page, showing a toast is a interactive action. It just cant function in a non interactive page.

htmlsplash commented 5 months ago

"showing a toast is a interactive action. It just cant function in a non interactive page." True, but you could drive it with purely javascript. We have this functionality in our Webforms app, is uses the original JS implementation of toaster and works identical to your version. Everything is done via JS. I guess your version is strongly tied to Blazor's interactivity model and would require re-write.

chrissainty commented 5 months ago

This library is for interactive Blazor applications, not static HTML pages (however they are generated). There are plenty of existing JavaScript libraries available for showing toasts. If I rewrote this library to just use JavaScript then all I would do is create yet another JavaScript toast library.

I believe there are Blazor wrappers for some existing JavaScript toast libraries so it might be worth you having a look for those and giving them a try.

htmlsplash commented 5 months ago

Makes sense, thank you.