update space bloc on community and space change

This commit is contained in:
hannathkadher
2025-03-05 12:28:00 +04:00
parent 51cfa8d5ae
commit 6e90f81760
6 changed files with 114 additions and 39 deletions

View File

@ -139,7 +139,6 @@ class SpaceManagementBloc
UpdateCommunityEvent event,
Emitter<SpaceManagementState> emit,
) async {
final previousState = state;
try {
final projectUuid = await ProjectManager.getProjectUUID() ?? '';
@ -154,6 +153,8 @@ class SpaceManagementBloc
for (var community in updatedCommunities) {
if (community.uuid == event.communityUuid) {
community.name = event.name;
_spaceTreeBloc.add(OnCommunityAdded(community));
break;
}
}
@ -456,8 +457,6 @@ class SpaceManagementBloc
event.communityUuid,
emit,
);
} else {
// add(LoadCommunityAndSpacesEvent());
}
} catch (e) {
emit(SpaceManagementError('Error saving spaces: $e'));
@ -481,6 +480,8 @@ class SpaceManagementBloc
for (var community in communities) {
if (community.uuid == communityUuid) {
community.spaces = allSpaces;
_spaceTreeBloc.add(OnCommunityUpdated(community));
emit(SpaceManagementLoaded(
communities: communities,
products: _cachedProducts ?? [],