@@ -106,7 +106,7 @@ export class SettingsEditor2 extends BaseEditor {
106106 private settingSlowUpdateDelayer : Delayer < void > ;
107107 private pendingSettingUpdate : { key : string , value : any } ;
108108
109- private viewState : ISettingsEditorViewState ;
109+ private readonly viewState : ISettingsEditorViewState ;
110110 private _searchResultModel : SearchResultModel ;
111111
112112 private tocRowFocused : IContextKey < boolean > ;
@@ -216,17 +216,25 @@ export class SettingsEditor2 extends BaseEditor {
216216 . then ( ( ) => {
217217 // Init TOC selection
218218 this . updateTreeScrollSync ( ) ;
219- } ) . then ( ( ) => {
220- const cachedState = this . editorMemento . loadState ( this . group , this . input ) ;
221- if ( cachedState ) {
222- const settingsTarget = cachedState . target ;
223- this . settingsTargetsWidget . settingsTarget = settingsTarget ;
224- this . viewState = { settingsTarget } ;
225- this . searchWidget . setValue ( cachedState . searchQuery ) ;
226- }
219+
220+ this . restoreCachedState ( ) ;
227221 } ) ;
228222 }
229223
224+ private restoreCachedState ( ) : void {
225+ const cachedState = this . editorMemento . loadState ( this . group , this . input ) ;
226+ if ( typeof cachedState . target === 'object' ) {
227+ cachedState . target = URI . revive ( cachedState . target ) ;
228+ }
229+
230+ if ( cachedState ) {
231+ const settingsTarget = cachedState . target ;
232+ this . settingsTargetsWidget . settingsTarget = settingsTarget ;
233+ this . onDidSettingsTargetChange ( settingsTarget ) ;
234+ this . searchWidget . setValue ( cachedState . searchQuery ) ;
235+ }
236+ }
237+
230238 setOptions ( options : SettingsEditorOptions ) : void {
231239 super . setOptions ( options ) ;
232240
@@ -1230,7 +1238,7 @@ export class SettingsEditor2 extends BaseEditor {
12301238
12311239 this . countElement . style . display = 'block' ;
12321240 this . noResultsMessage . style . display = count === 0 ? 'block' : 'none' ;
1233- this . clearFilterLinkContainer . style . display = this . viewState . tagFilters . size > 0
1241+ this . clearFilterLinkContainer . style . display = this . viewState . tagFilters && this . viewState . tagFilters . size > 0
12341242 ? 'initial'
12351243 : 'none' ;
12361244 }
0 commit comments