Help and docs
Sign in

R59 fix: start and stop watchers with mounted components

Browse files
grindlemire 23d 13 files +315 ~54 -98
Landed bygrindlemireas 88a50534 · with 7 other reviews See in history

Component watchers were collected once after the first render, so a
component mounted later never started its watchers, and an unmounted one
kept them running. The mount system now starts an instance's watchers
after the frame that mounted it is laid out (so a first OnChange call
sees refs and sizes, as root watchers do), and stops them when the
instance is swept. Unmounting closes the instance's stop channel on the
main loop, and channel, timer and OnChange handlers check it before
running, so a handler queued just before the unmount does not run.

SetRootComponent now resets the root session before its initial render,
so components mounted there are not discarded and mounted again (which
ran Init twice), and replacing a root fully unmounts its components.