fixed blank page rendering

This commit is contained in:
hannathkadher
2025-04-28 15:21:28 +04:00
parent 13cef151aa
commit 8dc833b2c3

View File

@ -466,6 +466,7 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
if (previousState is SpaceManagementLoaded) {
await _updateLoadedState(
event.context,
previousState,
allSpaces,
event.communityUuid,
@ -482,6 +483,7 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
}
Future<void> _updateLoadedState(
BuildContext context,
SpaceManagementLoaded previousState,
List<SpaceModel> allSpaces,
String communityUuid,
@ -489,7 +491,10 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
) async {
var prevSpaceModels = await fetchSpaceModels();
await fetchTags();
final communities = List<CommunityModel>.from(previousState.communities);
final spaceTreeState = context.read<SpaceTreeBloc>().state;
final communities = spaceTreeState.searchQuery.isNotEmpty
? spaceTreeState.filteredCommunity
: spaceTreeState.communityList;
for (var community in communities) {
if (community.uuid == communityUuid) {
@ -504,6 +509,8 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
spaceModels: prevSpaceModels,
allTags: _cachedTags ?? []));
return;
} else {
print("Community not found");
}
}
}