You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: this bug report uses Svelte components because that's the only framework I know, feel free to test with React and friends (assuming they also have ways to "bind elements") and compare the results.
This is a "companion" issue of #2725. The following bug happens when using client:load, client:idle, client:visible.
Bug description
When a Svelte component binds an element using bind:this, and the component is used more than once, all the instances of the component share the binding value. What I mean is, if I have a component doing something like
the result is three titles with the same content. They either all are "Test 1" or "Test 2" or "Test 3", randomly on the refresh. What I assume is the cause is that every element variable point to the same HTML element in the DOM.
Interestingly, this happens only with element binds, something like <input bind:value={content}> works as expected.
What version of
astro
are you using?0.23.7
What package manager are you using?
npm
What operating system are you using?
Linux
Describe the Bug
Note: this bug report uses Svelte components because that's the only framework I know, feel free to test with React and friends (assuming they also have ways to "bind elements") and compare the results.
This is a "companion" issue of #2725. The following bug happens when using
client:load
,client:idle
,client:visible
.Bug description
When a Svelte component binds an element using
bind:this
, and the component is used more than once, all the instances of the component share the binding value. What I mean is, if I have a component doing something likeand I add it to the page more than once
the result is three titles with the same content. They either all are "Test 1" or "Test 2" or "Test 3", randomly on the refresh. What I assume is the cause is that every
element
variable point to the same HTML element in the DOM.Interestingly, this happens only with element binds, something like
<input bind:value={content}>
works as expected.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-nejdnv-nidu66?file=src/pages/index.astro
The text was updated successfully, but these errors were encountered: