@@ -360,7 +360,7 @@ private async Task<JObject> GetLivePreviewData()
360360 headerAll . Add ( header . Key , ( String ) header . Value ) ;
361361 }
362362 }
363- mainJson . Add ( "live_preview" , this . LivePreviewConfig . LivePreview ?? "init" ) ;
363+ mainJson . Add ( "live_preview" , string . IsNullOrEmpty ( this . LivePreviewConfig . LivePreview ) ? "init" : this . LivePreviewConfig . LivePreview ) ;
364364
365365 if ( ! string . IsNullOrEmpty ( this . LivePreviewConfig . ManagementToken ) )
366366 {
@@ -402,7 +402,7 @@ public void SetEntryUid(string entryUid)
402402 {
403403 if ( ! string . IsNullOrEmpty ( entryUid ) )
404404 {
405- lastEntryUid = entryUid ;
405+ this . lastEntryUid = entryUid ;
406406 }
407407 }
408408 /// <summary>
@@ -420,7 +420,7 @@ public ContentType ContentType(String contentTypeName)
420420 {
421421 if ( ! string . IsNullOrEmpty ( contentTypeName ) )
422422 {
423- lastContentTypeUid = contentTypeName ;
423+ this . lastContentTypeUid = contentTypeName ;
424424 }
425425 ContentType contentType = new ContentType ( contentTypeName ) ;
426426 contentType . SetStackInstance ( this ) ;
@@ -610,18 +610,16 @@ public void SetHeader(string key, string value)
610610 public async Task LivePreviewQueryAsync ( Dictionary < string , string > query )
611611 {
612612 this . LivePreviewConfig . LivePreview = null ;
613- this . LivePreviewConfig . ContentTypeUID = null ;
614- this . LivePreviewConfig . EntryUID = null ;
615613
616614 if ( query . Keys . Contains ( "content_type_uid" ) )
617615 {
618616 string contentTypeUID = null ;
619617 query . TryGetValue ( "content_type_uid" , out contentTypeUID ) ;
620618 this . LivePreviewConfig . ContentTypeUID = contentTypeUID ;
621619 }
622- else if ( lastContentTypeUid != null )
620+ else if ( ! string . IsNullOrEmpty ( this . lastContentTypeUid ) )
623621 {
624- this . LivePreviewConfig . ContentTypeUID = lastContentTypeUid ;
622+ this . LivePreviewConfig . ContentTypeUID = this . lastContentTypeUid ;
625623 }
626624
627625
@@ -631,9 +629,9 @@ public async Task LivePreviewQueryAsync(Dictionary<string, string> query)
631629 query . TryGetValue ( "entry_uid" , out entryUID ) ;
632630 this . LivePreviewConfig . EntryUID = entryUID ;
633631 }
634- else if ( lastEntryUid != null )
632+ else if ( ! string . IsNullOrEmpty ( this . lastEntryUid ) )
635633 {
636- this . LivePreviewConfig . EntryUID = lastEntryUid ;
634+ this . LivePreviewConfig . EntryUID = this . lastEntryUid ;
637635 }
638636
639637
0 commit comments