@egil@mastodon.social
@egil@mastodon.social avatar

egil

@egil@mastodon.social

Distinguished Developer at Delegate A/S, Microsoft #MVP and creator of #bUnit (https://bunit.dev). 🇩🇰 living in 🇮🇸.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

khalidabuhakmeh, to random
@khalidabuhakmeh@mastodon.social avatar

This a question I have for users ( @alexzeitler and @egil) who are attempting to reduce repetition with components.

Do you think less components and more reusability is better, or are you losing some benefits of breaking down the UI into optimized functions?

I thought about this building my JetBrains store sample, too. I'm unsure where to draw the line of reuse vs. bespoke endpoints.

egil,
@egil@mastodon.social avatar

@khalidabuhakmeh @alexzeitler currently I lean towards:

  • If something can be a component that makes sense on its own, then, by all means, make it that. Then you can decide if it's a routable component or just a component that's used by other components.
  • If something only makes sense in the context of a component, but you still want to update it individually, then leveraging the template fragment pattern makes sense.

More detail in my answers here: https://github.com/egil/Htmxor/discussions/39

egil, to blazor
@egil@mastodon.social avatar

Continuing experiments with , aka. + . Working on enabling support for template fragments.

Input, feedback, suggestions are very welcome indeed: https://github.com/egil/Htmxor/discussions/37

egil,
@egil@mastodon.social avatar

Nerd sniping @khalidabuhakmeh 😘

egil,
@egil@mastodon.social avatar

@khalidabuhakmeh my example matches on a route, but the the point of a fragment is that it does not make sense on its own, otherwise, it may just as well be a routable component.

Here is another example where the fragments choose to render or not, based on request headers.

https://github.com/egil/Htmxor/blob/examples-project/samples/HtmxorExamples/Components/Pages/Examples/UpdatingOtherContent/TriggeringEvents.razor

This is the article that inspired the whole endeavor: https://htmx.org/essays/template-fragments/

So for me, making an fragment addressable does not make much sense as I see it.

egil,
@egil@mastodon.social avatar

@khalidabuhakmeh in terms of routable components, this is my first attempt at docs for how Htmxor does routing: https://github.com/egil/Htmxor/blob/main/docs/routing.md

egil, to blazor
@egil@mastodon.social avatar

Usssh, now I’ve done it. I actually have to talk about htmx and blazor next monday. So I need all you folks help, what are the libraries you are using? What are the good and bad things about that combo?

https://www.youtube.com/live/-Mc9pROA0Ho?si=mpxSGkSTVV2MJT5_

Pinging @khalidabuhakmeh and my and friends!

egil,
@egil@mastodon.social avatar

@brtkdotse @khalidabuhakmeh I agree with all your points actually. That’s also why my library Htmxor will solve all the points in the “reason not to” list. I am heavily modifying the component discovery logic, as well as the renderer, to make it’s aware of how htmx works.

egil,
@egil@mastodon.social avatar

@brtkdotse @khalidabuhakmeh well ok, still prototyping, so “I hope it will” solve all the things is probably more precise 😊

egil,
@egil@mastodon.social avatar

@brtkdotse @khalidabuhakmeh @patriksvensson the headers I have a solution for 🙂

egil,
@egil@mastodon.social avatar

@patriksvensson @khalidabuhakmeh @brtkdotse yeah I have looked at your stuff too. Have a custom HtmxContext that has a HtmxRequest and a HtmxResponse properties that provides access to incoming and outgoing headers. The context can be accessed in components. That's my best solution for now.

egil,
@egil@mastodon.social avatar

@khalidabuhakmeh @patriksvensson @brtkdotse something like that is almost possible. Cannot do custom directives until the razor compiler team enables that, but this is possible for the headers that are static (i.e., won't change based on request):

@attribute [Header("some header", "some value")]

egil,
@egil@mastodon.social avatar

@patriksvensson @brtkdotse @khalidabuhakmeh ill add header control through attributes to my todo list. It's a good idea.

egil,
@egil@mastodon.social avatar

@khalidabuhakmeh aaand that's a wrap. Did call you out a bunch of times (in a good way I hope) and quoted you quite a bit. Thanks for the input.

egil,
@egil@mastodon.social avatar

@khalidabuhakmeh so when I say call out, I just mean I referenced you a bunch, not in a disagreeing way 😊

egil,
@egil@mastodon.social avatar

@khalidabuhakmeh here is a pretty concise example of template fragments, routing, callbacks, setting response headers: https://github.com/egil/Htmxor/blob/main/samples/MinimalHtmxorApp/Components/Pages/Counter.razor

egil,
@egil@mastodon.social avatar

@khalidabuhakmeh agreed. Good point. Still learning, but did figure out that trick with blazing pizza and the orders and configure logic.

thomasfuchs, to random
@thomasfuchs@hachyderm.io avatar

Don’t believe me that DHH means the n-word when he rants about DEI?

Maybe you believe the mayor of Baltimore: https://www.thebaltimorebanner.com/politics-power/national-politics/brandon-scott-dei-mayor-racist-C3MWO3BVX5FJZM5MENNLC2X2BI/

(Hi, Rails Core, how’s things going for you?)

egil,
@egil@mastodon.social avatar

@thomasfuchs I'm curious, do you have links to said rants?

I grow up in Denmark like DHH and I am from the same generation as him, and racism against black people isn't at all comparable to what you see in the States.

So judging his statements from an American cultural conservative perspective may lead to misinterpreting. I consider his views conservative by Danish standards, but not US.

(Prejudice against immigrants from Islamic and Baltic counties is an issue in Denmark).

ICooper, to dotnet
@ICooper@hachyderm.io avatar

We may need a simpler repro of the issue, but for now we would advise against using a Primary Constructor for a Brighter Handler. We are seeing an issue where the arguments are null for a primary constructor, but non-null for an explicit constructor.

My guess would be that the compiler cannot understand that the handler is invoked at runtime.

egil,
@egil@mastodon.social avatar

@ICooper that does not make much sense to me. As far as I can tell, primary constructors gets lowered to old fashion constructors:

egil,
@egil@mastodon.social avatar

@khalidabuhakmeh @ICooper still looks quite normal. Would have made the field readonly in this case myself, but otherwise some same.

egil, to random
@egil@mastodon.social avatar

Hey folks, trying StreamYard with my co-maintainer of bUnit while we work on bUnit.

https://www.youtube.com/watch?v=mszrTpuclgs

vivainio, to random
egil,
@egil@mastodon.social avatar

@vivainio @khalidabuhakmeh I just have experiments still and nothing fully backed, but you can follow my endeavors at https://github.com/egil/Htmxor

khalidabuhakmeh, to random
@khalidabuhakmeh@mastodon.social avatar

I was going to spend time writing a very “clever” blog post about string interning entries while reading from a log, but a BenchmarkDotNet run debunked my cleverness. 😅

egil,
@egil@mastodon.social avatar

@khalidabuhakmeh write a blog post about your process. Probably quite a few that could learn from "validate your performance assumptions" 😀

egil, to random
@egil@mastodon.social avatar

@khalidabuhakmeh I have been reading though the docs and it seems like an extended version of Blazor Web Apps enhanced navigation and form handling (https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/routing?view=aspnetcore-8.0). Do you know of anybody who has combined Blazor page components with HTMX, replacing enhanced navigation and form handling from Blazor?

I've seen your Razor/cshtml pages packages and tutorial, so thought you may know.

egil,
@egil@mastodon.social avatar

@alexzeitler @khalidabuhakmeh I've been playing around with different ideas.

Here we have the "contacts app index page" with a custom <HtmxRequestView> component.

The code in (1) is shared independent of the request type (htmx/not htmx) and the FullPageContent component is able to reference the HtmxContent and include that (2).

You could even have multiple HtmxContent components that are used under different conditions (Triggers/Targets/etc.).

What do you think?
Am I on the right track?

egil,
@egil@mastodon.social avatar

@khalidabuhakmeh @alexzeitler the App.razor uses the same HtmxRequestView component only include the Router component for HTMX requests. Then I have a custom HtmxRouterView component in the Router component that skips the layout for HTMX requests.

Still just just experimenting with the "dev experience", so things are a bit hacky.

egil,
@egil@mastodon.social avatar

@alexzeitler @khalidabuhakmeh there are no double executions in this case.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • anitta
  • InstantRegret
  • magazineikmin
  • Youngstown
  • everett
  • thenastyranch
  • slotface
  • vwfavf
  • mdbf
  • rosin
  • kavyap
  • khanakhh
  • cubers
  • PowerRangers
  • provamag3
  • DreamBathrooms
  • tacticalgear
  • Durango
  • ethstaker
  • osvaldo12
  • ngwrru68w68
  • cisconetworking
  • tester
  • GTA5RPClips
  • normalnudes
  • modclub
  • Leos
  • megavids
  • All magazines