-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
[🐞] attribute of the layout or parent component doesn't be reactive from the change of the context of the child components. #7070
Comments
This is expected behavior and it is the same in v1: What's happening is, the div style is output and then the child renders, which changes the context color. So the div is already sent to the browser and can no longer be changed. When you run this in the browser (click rerender), it updates as expected. |
@wmertens <script>
document.currentScript.previousElementSibling.attributes = ... ;
</script> |
This is really complex and in any case you'll get a flash of wrongly styled content + you require JS. There are two real solutions:
Solution 1 uses more memory and slows down time-to-first-byte. |
@wmertens |
The typical placeholder component will be vanished if its contents is not found. |
@genki actually the SSR code assumes that it can emit HTML while visiting the JSX tree, and implementing what you propose would be a big hit in performance, plus it would be a lot of code changes. Why can't you make sure that context values are fixed before you render? You can change them from tasks before you do the first output. You could also render on the client instead of on the server (with a |
@wmertens |
To achieve that, there can be |
Which component is affected?
Qwik Runtime
Describe the bug
I am making a layout that changes its look depending on its child, but the attributes of the layout is not reactive when the context is updated in the child components.
Strangingly, the contents of the layout is correctly changed reactively according to the update of the context.
The expected behaviour is the attribute should be changed reactively when the context updated.
Reproduction
https://qwikdev-build-v2.qwik-8nx.pages.dev/playground/#f=7VbBCsIwDP2V0pPCELw4HOhl4MmfEB1exMLwoMz%2Bu2mSptlWZR68eeu2vCxJX5KnSLMqyxxpiiHTCtmaeMJtjCe20OdI1w96BimwPzygJ2kIb7BAR3dxbWVs25zs057bprnacANUT7Kvb3ewHjaC8rWdWZhR8GQhW4bunAugHL3JgBBgozpQ%2Fgd%2BTFINCWoYtsC4ASwhG%2BPnqnVEjIU4Og3y8JoVGCAm9SMLKC6bSKNeBSg6KidWM0aUGSqSZkFOMduRmIwaqUt7tyJ7TsRPk5vwHYogFK3pxjvtaSRL38%2BZ5Vop6W%2FmTI%2BR%2FynziynzAg
Steps to reproduce
Please see the link above and confirm the style attribute is not changed despite of its content is changed.
System Info
Additional Information
No response
The text was updated successfully, but these errors were encountered: