motiondivision / motion

A modern animation library for React and JavaScript
https://motion.dev
MIT License
25.66k stars 842 forks source link

Remove mount layout animation check #2853

Open mattgperry opened 3 weeks ago

mattgperry commented 3 weeks ago

Currently, MeasureLayout calls didUpdate on mount because it could be the case that a layout animation has been triggered where all the snapshotted elements were removed during the render and nothing would be left to call it otherwise. This PR removes unused layout animation initialisations by checking if this happened before scheduling layout measurements.

It also ensures we only measure scroll when we take our first snapshot.