Describe the bug
As the title, when using imported object for element style attribute, it is reevaluated if other attributes that use signal that is updated.
In this example a button element style uses an imported object called style which has background value of red.
export const style = {
"background": "red",
}
After the button is mounted then it's background is changed to blue via element style property.
import { style } from "./style"
// ...
onMount(() => {
buttonEl.style.background = 'blue'
})
return (
<button style={style} ... ref={buttonEl}>
{count()}
</button>
);
}
This button's aria-label attribute uses count signal which increments when clicked
const [count, setCount] = createSignal(1);
const increment = () => setCount(count() + 1);
let buttonEl;
onMount(() => {
buttonEl.style.background = 'blue'
})
return (
<button type="button" onClick={increment} aria-label={count().toString()} style={style} ref={buttonEl}>
{count()}
</button>
Your Example Website or App
https://playground.solidjs.com/anonymous/804fbf3b-2166-430f-ab99-c2b78770a1a6
Steps to Reproduce the Bug or Issue
- Click counter button
Expected behavior
For button's background color to remain blue, but after clicking button it resets red which is the background property from object style. If button style attribute uses style2 object, which is not imported then the button remains blue after updating count signal https://playground.solidjs.com/anonymous/efc28da8-a36c-42e5-b109-5d7b8a8c145e.
Screenshots or Videos
No response
Platform
- OS: macOS
- Browser: Chrome
- Version: 118.0.5993.117
Additional context
No response
Describe the bug
As the title, when using imported object for element style attribute, it is reevaluated if other attributes that use signal that is updated.
In this example a button element style uses an imported object called
stylewhich has background value of red.After the button is mounted then it's background is changed to blue via element style property.
This button's aria-label attribute uses count signal which increments when clicked
Your Example Website or App
https://playground.solidjs.com/anonymous/804fbf3b-2166-430f-ab99-c2b78770a1a6
Steps to Reproduce the Bug or Issue
Expected behavior
For button's background color to remain blue, but after clicking button it resets red which is the background property from object
style. If button style attribute usesstyle2object, which is not imported then the button remains blue after updating count signal https://playground.solidjs.com/anonymous/efc28da8-a36c-42e5-b109-5d7b8a8c145e.Screenshots or Videos
No response
Platform
Additional context
No response