Skip to content

Instantly share code, notes, and snippets.

@iamdustan
Created May 31, 2016 20:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamdustan/f81a4eca31fbbada756011f5b56f5ab1 to your computer and use it in GitHub Desktop.
Save iamdustan/f81a4eca31fbbada756011f5b56f5ab1 to your computer and use it in GitHub Desktop.

Half-baked thoughts on React’s Incremental Reconciler

Both React’s incremental reconciler and Angular’s digest cycle have the property that additional work will be scheduled outside of the consumers control.

Arguably with React this has always been true and the incremental reconciler is simply another layer for scheduling work.

To date, React’s reconciler has been an implementation detail that I’ve never had to consider while developing applications. Neither have I ever heard someone say “well that’s just how the reconciliation works” or “fighting the reconciliation engine”. Contrast this to angular where the digest cycle is a constant thorn the developer must be aware of and combat excessively.

My question/concern is will the incremental nature of the new reconciler leak through to the consumer? Will this continue to stay a black box that just works or will public APIs and components need to account for this in some capacity?


This was the initial thought experiment I had while considering possible correlations between the digest cycle and the incremental reconciler.

Will the incremental reconciler make certain properties of React’s initial mounting unpredictable? I do not currently hold any reservations about the incremental reconciler’s impact on scheduled reconciliations in response to user actions.

Use cases:

  • ReactResolver recursively resolves all ReactDOM.renderToString calls to do server-side rendering once all side-effects of mounting have been resolved.
  • RUM tracking when the initial render is complete.

Regarding server-rendering with ReactResolver (and similar solutions), this may be drastically simplified or improved. ...especially if there is overlap between the incremental reconciler and streaming server.

Regarding the RUM tracking, this is also likely no different than the case today where you need to measure this based on all the leaves being rendered which is difficult to do statically. Rather, marking when major segments of the UI are rendered likely makes more sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment