Open renardeinside opened 10 months ago
I don't know if it is possible to avoid calculating the partial update on the server side but if you're only trying to update the span
why not just send only the span
tag back to the client instead of the entire div
or is there something in your use case that requires you to return the entire div
I'm trying to use
htmx
+morph
in combination withFastApi
to write a server-driven python app.My template code is as follows:
And my app code is also quite simple:
My idea is the following - whenever there is a user interaction, I'm re-rendering the whole page on the server side and sending a specific part of it back via the WebSocket (the
div
withid="app"
attribute).I wasa hoping that since all of the elements have an
id
, morph plugin would easily recognize that the only thing changing is thespan
and therefore refresh only it.However, it updates the whole
div id="app"
element, which i can see by the animation on the buttons.Is it possible to somehow setup the plugin to avoid calculating the partial update on the server side? Considering that the app is going to grow in size, it would be quite inconvenient to figure out the specific updates on the server side.