@@ -148,18 +148,20 @@ const InstanceModel = AmpersandModel.extend(
148148 } ) ;
149149
150150 // Listen to preference changes using the preferences API
151- this . _preferenceUnsubscribe = preferences . onPreferenceValueChanged (
152- 'enableDbAndCollStats' ,
153- ( value ) => {
154- this . set ( { shouldFetchDbAndCollStats : value } ) ;
155- }
156- ) ;
157- this . _preferenceUnsubscribe = preferences . onPreferenceValueChanged (
158- 'inferNamespacesFromPrivileges' ,
159- ( value ) => {
160- this . set ( { shouldFetchNamespacesFromPrivileges : value } ) ;
161- }
162- ) ;
151+ this . _enableDbAndCollStatsUnsubscribe =
152+ preferences . onPreferenceValueChanged (
153+ 'enableDbAndCollStats' ,
154+ ( value ) => {
155+ this . set ( { shouldFetchDbAndCollStats : value } ) ;
156+ }
157+ ) ;
158+ this . _inferNamespacesFromPrivilegesUnsubscribe =
159+ preferences . onPreferenceValueChanged (
160+ 'inferNamespacesFromPrivileges' ,
161+ ( value ) => {
162+ this . set ( { shouldFetchNamespacesFromPrivileges : value } ) ;
163+ }
164+ ) ;
163165
164166 AmpersandModel . prototype . initialize . call ( this , props ) ;
165167 } ,
@@ -420,8 +422,11 @@ const InstanceModel = AmpersandModel.extend(
420422
421423 removeAllListeners ( ) {
422424 // Clean up preference listeners
423- if ( this . _preferenceUnsubscribe ) {
424- this . _preferenceUnsubscribe ( ) ;
425+ if ( this . _enableDbAndCollStatsUnsubscribe ) {
426+ this . _enableDbAndCollStatsUnsubscribe ( ) ;
427+ }
428+ if ( this . _inferNamespacesFromPrivilegesUnsubscribe ) {
429+ this . _inferNamespacesFromPrivilegesUnsubscribe ( ) ;
425430 }
426431 InstanceModel . removeAllListeners ( this ) ;
427432 } ,
0 commit comments