@@ -589,16 +589,6 @@ define(function (require, exports, module) {
589589 _togglePinUrl ( ) ;
590590 }
591591 $iframe . attr ( 'src' , StaticServer . getNoPreviewURL ( ) ) ;
592- if ( ! panelShownAtStartup && ! isBrowser ) {
593- // we dont do this in browser as the virtual server may not yet be started on app start
594- // project open and a 404 page will briefly flash in the browser!
595- const currentDocument = DocumentManager . getCurrentDocument ( ) ;
596- const currentFile = currentDocument ? currentDocument . file : ProjectManager . getSelectedItem ( ) ;
597- const isPreviewable = currentFile ? utils . isPreviewableFile ( currentFile . fullPath ) : false ;
598- if ( isPreviewable ) {
599- _setPanelVisibility ( true ) ;
600- }
601- }
602592 if ( ! panel . isVisible ( ) ) {
603593 return ;
604594 }
@@ -661,10 +651,14 @@ define(function (require, exports, module) {
661651 }
662652 if ( changedFile && ( utils . isPreviewableFile ( fullPath ) ||
663653 utils . isServerRenderedFile ( fullPath ) ) ) {
654+ _loadPreview ( ) ;
664655 if ( ! panelShownAtStartup ) {
665- _setPanelVisibility ( true ) ;
656+ let previewDetails = await StaticServer . getPreviewDetails ( ) ;
657+ if ( previewDetails && ! previewDetails . isNoPreview ) {
658+ _setPanelVisibility ( true ) ;
659+ _loadPreview ( ) ;
660+ }
666661 }
667- _loadPreview ( ) ;
668662 }
669663 }
670664
@@ -748,6 +742,8 @@ define(function (require, exports, module) {
748742 return ;
749743 }
750744 panelShownAtStartup = ! LivePreviewSettings . shouldShowLivePreviewAtStartup ( ) ;
745+ Metrics . countEvent ( Metrics . EVENT_TYPE . LIVE_PREVIEW , "atStart" ,
746+ LivePreviewSettings . shouldShowLivePreviewAtStartup ( ) ? "show" : "hide" ) ;
751747 _createExtensionPanel ( ) ;
752748 StaticServer . init ( ) ;
753749 LiveDevServerManager . registerServer ( { create : _createStaticServer } , 5 ) ;
0 commit comments