forked from Nexus/nexus
fixup room selected fallbacks
This commit is contained in:
parent
77f06005e5
commit
cba13aa6c7
2 changed files with 10 additions and 3 deletions
|
|
@ -22,9 +22,16 @@ class SelectedRoomController extends Notifier<String?> {
|
|||
.addAll([?space.room?.metadata?.id]),
|
||||
),
|
||||
);
|
||||
if (roomIds == null) return roomId;
|
||||
if (roomIds == null || roomIds.contains(roomId)) return roomId;
|
||||
|
||||
return roomIds.contains(roomId) ? roomId : roomIds.firstOrNull;
|
||||
final fallback = roomIds.firstOrNull;
|
||||
Future.microtask(() {
|
||||
if (!ref.mounted) return;
|
||||
ref
|
||||
.read(KeyController.provider(KeyController.roomKey).notifier)
|
||||
.set(fallback);
|
||||
});
|
||||
return fallback;
|
||||
}
|
||||
|
||||
static final provider = NotifierProvider<SelectedRoomController, String?>(
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class const SpacesRail({super.key}) extends ConsumerWidget {
|
|||
.set(spaces[value].id);
|
||||
ref
|
||||
.read(KeyController.provider(KeyController.roomKey).notifier)
|
||||
.set(spaces[value].children.firstOrNull?.metadata?.id);
|
||||
.set(spaces[value].allChildRooms.firstOrNull?.metadata?.id);
|
||||
},
|
||||
sections: [
|
||||
.new(
|
||||
|
|
|
|||
Loading…
Reference in a new issue