Created
August 23, 2024 05:11
-
-
Save KonnorRogers/3e91b8db091895778ddb9dfd6df1a46a to your computer and use it in GitHub Desktop.
the joy of SSR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Case 1 --> | |
<my-input value="foo"> | |
<template shadowrootmode="open"> | |
<input value="foo"> | |
</template> | |
</my-input> | |
<script> | |
myInput.value = "bar" | |
customElements.define("my-input", MyInput) | |
// => <my-input value="foo"> | |
// myInput.value => "bar" | |
</script> | |
<!-- Case 2 --> | |
<my-input value="foo"> | |
<template shadowrootmode="open"> | |
<input value="foo"> | |
</template> | |
</my-input> | |
<script> | |
myInput.value = null | |
customElements.define("my-input", MyInput) | |
// => <my-input value="foo"> | |
// myInput.value => null | |
</script> | |
<!-- Case 3 --> | |
<my-input value="foo"> | |
<template shadowrootmode="open"> | |
<input value="foo"> | |
</template> | |
</my-input> | |
<script> | |
myInput.value = "bar" | |
myInput.defaultValue = "baz" | |
customElements.define("my-input", MyInput) | |
// => <my-input value="baz"> | |
// myInput.value => "bar" | |
</script> | |
Solution: not sure yet. TLDR: tracking dirty values prior to the component connecting. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment