-
Notifications
You must be signed in to change notification settings - Fork 0
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
Issue research #1
Comments
One way to get rid of the double rendering is:
|
And a better way, to remove the back and forth between buffer -> string -> buffer:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When clicking the button, you see empty attributes in the JS. This is because, when adding fragments to the page, it's comparing two empty strings to each other as "lastRenderedHTML". There's no diffs, so its generating empty lists.
This does not occur when no fragments are present or when you're loading fragments locally, because hydraconnectioncontroller#askHydraForFragment has a shortcut that provides an instant response. In the scenario of an actual fragment being loaded from a different instance, there's no instance response but a slightly delayed one due to the wait for a hydra REST call to complete. The rest call itself is not the problem, but the additional delay explains the difference in behavior.
It also means that the cause of the error happens at render already, even though the render itself visually looks ok. Behind the scenes, the session is loaded with an empty 'lastRenderedHTML' meaning that any future changes are compared to an empty string, causing wrong attributes to be loaded.
So, specifically, the problem is here:
https://github.com/medusa-ui/medusa/blob/eeb1c2e9cb171dc7c2901bdd1ea1f87239d2bf5d/medusa-ui/src/main/java/io/getmedusa/medusa/core/router/action/SocketHandler.java#L81-L84
Essentially, the
final Flux<DataBuffer> dataBufferFlux = renderer.render(route.getTemplateHTML(), s);
only works with immediate responses. When the Flux can actually have a delay -- because for example, it's a REST call with network latency -- then thes.setLastRenderedHTML(newHtml);
resolves before the Flux completes, causing the empty string.One way to fix it would be something like:
But it doesn't render right on action yet
The text was updated successfully, but these errors were encountered: