Closed tanczosm closed 6 months ago
This addresses #2 tasks 1 and 2. It still needs to be able to handle post, put and delete payloads from request. The Context perspective is server-side (request), with all client-side (response) functions needing to be executed through InvokeHtmx
context.InvokeHtmx(h => {
h.PushUrl("/new-url")
.WithTrigger("cool")
}
The side effect of this perspective is that it makes most request headers immediately available to the developer.
Hey @tanczosm, appreciate your effort here.
That said, it's too early to decide on whether or not to take a dependency on Khalids excellent library. I will reconsider this when other parts of the library that will depend on reading and writing headers are more settled.
There is also an inherent risk when you take a dependency on another library, which itself has a dependency on Htmx, which Htmxor also has. There is a risk that one library will be able support a newer version of Htmx before the other, which could lead to issues down the road.
Thus, I will close this for now and revisit in the future.
This PR does not address Antiforgery options though, but Htmx.Net employs a cookie-less approach that may be more suited to production use but is currently in the Tag Helpers nuget package and thus unsuitable to use with Blazor.
Can you elaborate on why you don't think using cookies is suitable for production, preferable over in the #3 issue. I am curious about what problems you are seeing with this approach.
Wrt. Htmx request and response headers, I would love to hear your thoughts over in #2 about the pros and cons of the API. What works from Khalids library compared to my approach. Ill update the issue with a description of the approach I am currently planning.
Khalid's Htmx.Net is a much more mature base for Htmx extensions. Deferring to Htmx.Net offloads most of the Htmx-specific issues regarding request/response headers and can be utilized in other client libraries. This PR does not address Antiforgery options though, but Htmx.Net employs a cookie-less approach that may be more suited to production use but is currently in the Tag Helpers nuget package and thus unsuitable to use with Blazor.