@@ -21,6 +21,7 @@ import { AsyncStoreWithClient } from "./AsyncStoreWithClient";
21
21
import defaultDispatcher from "../dispatcher/dispatcher" ;
22
22
import { arrayHasDiff } from "../utils/arrays" ;
23
23
import { RoomListStoreTempProxy } from "./room-list/RoomListStoreTempProxy" ;
24
+ import { isNullOrUndefined } from "matrix-js-sdk/src/utils" ;
24
25
25
26
const MAX_ROOMS = 20 ; // arbitrary
26
27
const AUTOJOIN_WAIT_THRESHOLD_MS = 90000 ; // 90s, the time we wait for an autojoined room to show up
@@ -51,7 +52,11 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
51
52
}
52
53
53
54
public get visible ( ) : boolean {
54
- return this . state . enabled && this . matrixClient . getVisibleRooms ( ) . length >= 20 ;
55
+ return this . state . enabled && this . meetsRoomRequirement ;
56
+ }
57
+
58
+ private get meetsRoomRequirement ( ) : boolean {
59
+ return this . matrixClient . getVisibleRooms ( ) . length >= 20 ;
55
60
}
56
61
57
62
protected async onAction ( payload : ActionPayload ) {
@@ -99,8 +104,9 @@ export class BreadcrumbsStore extends AsyncStoreWithClient<IState> {
99
104
}
100
105
101
106
private onMyMembership = async ( room : Room ) => {
102
- // We turn on breadcrumbs by default once the user has at least 1 room to show.
103
- if ( ! this . state . enabled ) {
107
+ // Only turn on breadcrumbs is the user hasn't explicitly turned it off again.
108
+ const settingValueRaw = SettingsStore . getValue ( "breadcrumbs" , null , /*excludeDefault=*/ true ) ;
109
+ if ( this . meetsRoomRequirement && isNullOrUndefined ( settingValueRaw ) ) {
104
110
await SettingsStore . setValue ( "breadcrumbs" , null , SettingLevel . ACCOUNT , true ) ;
105
111
}
106
112
} ;
0 commit comments