Skip to content

[LiveComponent] Smart rendering problems #781

@norkunas

Description

@norkunas

Thanks for bringing this up @norkunas - I figured there would be some real-world hiccups we'd need to work through.

so after rerender checkbox becomes unchecked but the class is still left here even backend returns the element without custom checked class.

That makes sense. Question: BEFORE the new re-rendering system, did you have the opposite problem? When the Stimulus controller added the checked class, when the live component re-rendered (not via the action, just a normal re-render), didn't it NOT include the custom class? And so, didn't the re-render cause the custom class to be lost? Or do you have the "if checked -> add custom class" logic both inside of Twig and also include if your Stimulus controller? And if so, why do you have it in both places? Is it just to make the experience feel faster / more responsive (i.e. as SOON as the user checks the box, the class is added, without needing to wait for the re-render)?

Btw, feel free to open a new issue - I don't want this to get lost on a merged PR - I sometimes catch these notifications, and sometimes not :)

Originally posted by @weaverryan in #728 (comment)

Yes, in backend I use html_classes to apply them based on states.
The component was made to work without live components - so for UI to know what color class to apply on checkbox If it's checked I need to expose it to stimulus.
So now with in a different part of app it was integrated into a live component and then the problem arose. And yes - it is to make experience feel faster :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions