From 7f882b00f56e27bf3ddeb7118df0f7093403c8ef Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Mon, 28 Jul 2014 14:42:35 -0600 Subject: [PATCH] Don't allow updates to be requested for unmounted components In 444c18be34ffbf3a3151508fef57fde988d4e8f2, I stopped polling the DOM when an update was pending to prevent delay of the next animation frame. Unfortunately, we rely on synchronously polling the DOM when an editor view is attached to perform the initial measurement of the default char width, which is required to position the wrap guide. In componentWillMount, observing the config was requesting an update, causing us to skip this synchronous update at attachment time and position the wrap guide wrong. This prevents update requests that occur before mount from pausing the polling that we perform on attachment, restoring correct function to the wrap guide. --- src/editor-component.coffee | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/editor-component.coffee b/src/editor-component.coffee index 8e0aab735..ffa585d26 100644 --- a/src/editor-component.coffee +++ b/src/editor-component.coffee @@ -226,6 +226,8 @@ EditorComponent = React.createClass @performedInitialMeasurement = true requestUpdate: -> + return unless @isMounted() + if @updatesPaused @updateRequestedWhilePaused = true return