preact-devtools icon indicating copy to clipboard operation
preact-devtools copied to clipboard

Updates to text nodes caused by signal changes are not hightlighted

Open nicolo-ribaudo opened this issue 2 years ago • 2 comments

Demo:

const s = signal(0);

function inc() {
  s.value++;
}

export default function App() {
  return html`
    ${s}
    <button onclick=${inc}>Increment</button>
  `;
}

When "Highlight updates" is enabled, I would expect the number to be highlighted every time it changes because I click on the button.

https://user-images.githubusercontent.com/7000710/225608523-08a31b8f-98ff-45ad-8d58-4d8b9fe1669e.mov

nicolo-ribaudo avatar Mar 16 '23 11:03 nicolo-ribaudo

I don't think it should... since your using the templated value {inc} this is an optimized mechanism that doesn't re-render the component. Change it to {inc.value} and you will see it update, as this DOES cause the re-render 👍🏻

richbayliss avatar Apr 16 '24 12:04 richbayliss

The component is not re-rendered, but the text node is.

nicolo-ribaudo avatar Apr 16 '24 12:04 nicolo-ribaudo