Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable streaming rendering #16

Open
egil opened this issue Apr 21, 2024 · 6 comments
Open

Enable streaming rendering #16

egil opened this issue Apr 21, 2024 · 6 comments

Comments

@egil
Copy link
Owner

egil commented Apr 21, 2024

No description provided.

@tanczosm
Copy link
Collaborator

tanczosm commented Apr 24, 2024

For streaming rendering just be careful because Htmx doesn't support streaming rendering on requests at the moment.

@egil
Copy link
Owner Author

egil commented Apr 24, 2024

For streaming rendering just be careful because Htmx doesn't support streaming rendering on requests at the moment.

What do you mean exactly? I imagine a custom plugin is needed to handle the response during streaming rendering so that it gets patched into the DOM correctly. Didn't you manage to get something like that to work?

@tanczosm
Copy link
Collaborator

Ah I forgot we discussed this exact thing. Htmx natively just handles responses only when they have completed, so you end up having to wait out the entire streaming result But yes, I did create an extension to handle that issue. It will need some small updating for htmx 2.0 though since they changed the swapping api methods but the changes are just a few lines. If you get streaming to work then it can work via an extension.

@egil
Copy link
Owner Author

egil commented Apr 25, 2024

Yeah, sounds good. I'm just trying to get the basics working, then adding streaming. can you share a link to your extension so I can have a look when I get the time to look at streaming?

@tanczosm
Copy link
Collaborator

tanczosm commented Apr 25, 2024

Here you go:

https://github.com/JalexSocial/Rizzy/blob/main/src/Rizzy/wwwroot/js/blazor-streaming.js

Note that one issue with this code is it defines the blazor-ssr-end html element internally, which if used with blazor.web.js would require the component to be loaded after blazor.web.js (it checks to see if the blazor-ssr-end html element is already defined) but admittedly I haven't tested this scenario because blazor.web.js also implements a lot of functionality similar to htmx that is only used by Blazor so I've tried to steer clear of any blazor javascript dependencies.

@egil
Copy link
Owner Author

egil commented Apr 25, 2024

Yeah, may current strategy is to completely remove blazer.web.js from the mix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants