Subscribe on changes!

onRenderTriggered doesn't trigger on a primitive prop change

avatar
Mar 20th 2022

Version

3.2.31

Reproduction link

codepen.io

Steps to reproduce

According to docs, I expect any props change will trigger this hook, but it doesn't happen on change primitive prop, with add array element or object property.

What is expected?

onRenderTriggered triggers

What is actually happening?

it doesn't

avatar
Mar 22nd 2022

Is this a bug? According to the document onrendertriggered, when render effect to be re-run, onRenderTriggered will be called. However, in the development environment, props will be shallowreadonly, so using the original type will not trigger track, so when changes occur, effect will not be triggered Run, there is no way to trigger the onrendertrigged callback. At present, the normal rendering is updated through patch. I try to start recursive update, but this will make the component update function call twice. I also hope to get an answer