File tree Expand file tree Collapse file tree 1 file changed +4
-12
lines changed
lib/content_management/bloc/archived_headlines Expand file tree Collapse file tree 1 file changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -183,20 +183,12 @@ class ArchivedHeadlinesBloc
183183 } else if (status == DeletionStatus .undone) {
184184 // Deletion undone, restore the headline to the main list.
185185 if (item is Headline ) {
186+ final insertionIndex = state.headlines.indexWhere (
187+ (h) => h.updatedAt.isBefore (item.updatedAt),
188+ );
186189 final updatedHeadlines = List <Headline >.from (state.headlines)
187190 ..insert (
188- state.headlines.indexWhere (
189- (h) => h.updatedAt.isBefore (
190- item.updatedAt,
191- ),
192- ) !=
193- - 1
194- ? state.headlines.indexWhere (
195- (h) => h.updatedAt.isBefore (
196- item.updatedAt,
197- ),
198- )
199- : state.headlines.length,
191+ insertionIndex != - 1 ? insertionIndex : state.headlines.length,
200192 item,
201193 );
202194 emit (
You can’t perform that action at this time.
0 commit comments