From faf80fa77c4f0e4ddc32aa3db753aef65635918d Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Fri, 29 Jul 2016 11:08:07 -0700 Subject: [PATCH] Prevent low-fidelity live preview of post title from running at refresh See #43 --- js/customize-post-field-partial.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/customize-post-field-partial.js b/js/customize-post-field-partial.js index 7540633..0520b91 100644 --- a/js/customize-post-field-partial.js +++ b/js/customize-post-field-partial.js @@ -62,8 +62,8 @@ // Post title. if ( 'post_title' === partial.params.field_id ) { api( settingId, function( setting ) { - setting.bind( function( postData ) { - if ( ! postData || ! _.isString( postData.post_title ) ) { + setting.bind( function( newPostData, oldPostData ) { + if ( ! newPostData || oldPostData && newPostData.post_title === oldPostData.post_title ) { return; } _.each( partial.placements(), function( placement ) { @@ -71,7 +71,7 @@ if ( ! target.length ) { target = placement.container; } - target.text( postData.post_title ); + target.text( newPostData.post_title ); } ); } ); } );