Skip to content

Commit f8dd61e

Browse files
committed
fix(content_management): update topic with correct createdAt value
- Remove createdAt field from updatedTopic creation - Fetch original topic from repository before update - Use original topic's createdAt value for update operation
1 parent fe84a93 commit f8dd61e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/content_management/bloc/edit_topic/edit_topic_bloc.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,12 @@ class EditTopicBloc extends Bloc<EditTopicEvent, EditTopicState> {
105105

106106
emit(state.copyWith(status: EditTopicStatus.submitting));
107107
try {
108-
final updatedTopic = Topic(
109-
id: state.topicId,
108+
final originalTopic = await _topicsRepository.read(id: state.topicId);
109+
final updatedTopic = originalTopic.copyWith(
110110
name: state.name,
111111
description: state.description,
112112
iconUrl: state.iconUrl,
113113
status: state.contentStatus,
114-
createdAt:
115-
DateTime.now(), // This should ideally be the original createdAt
116114
updatedAt: DateTime.now(),
117115
);
118116

0 commit comments

Comments
 (0)