Skip to content

Commit 0eac06a

Browse files
committed
refactor(content_management): replace pendingDeletions map with snackbarHeadlineTitle
- Remove pendingDeletions map from ArchivedHeadlinesState - Add snackbarHeadlineTitle to store the title of the headline for which the snackbar should be displayed - Update copyWith method to reflect changes - Update props list in ArchivedHeadlinesState to include new field
1 parent 3aa8067 commit 0eac06a

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

lib/content_management/bloc/archived_headlines/archived_headlines_state.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class ArchivedHeadlinesState extends Equatable {
3030
this.hasMore = false,
3131
this.exception,
3232
this.restoredHeadline,
33-
this.pendingDeletions = const {},
3433
this.lastPendingDeletionId,
34+
this.snackbarHeadlineTitle,
3535
});
3636

3737
/// The current status of the archived headlines operations.
@@ -53,14 +53,15 @@ class ArchivedHeadlinesState extends Equatable {
5353
/// The headline that was most recently restored, if any.
5454
final Headline? restoredHeadline;
5555

56-
/// A map of headlines that are currently pending permanent deletion,
57-
/// keyed by their ID.
58-
final Map<String, Headline> pendingDeletions;
59-
6056
/// The ID of the headline that was most recently added to pending deletions.
6157
/// Used to trigger the snackbar display.
6258
final String? lastPendingDeletionId;
6359

60+
/// The title of the headline for which the snackbar should be displayed.
61+
/// This is set when a deletion is requested and cleared when the snackbar
62+
/// is no longer needed.
63+
final String? snackbarHeadlineTitle;
64+
6465
/// Creates a copy of this [ArchivedHeadlinesState] with updated values.
6566
ArchivedHeadlinesState copyWith({
6667
ArchivedHeadlinesStatus? status,
@@ -69,8 +70,8 @@ class ArchivedHeadlinesState extends Equatable {
6970
bool? hasMore,
7071
HttpException? exception,
7172
Headline? restoredHeadline,
72-
Map<String, Headline>? pendingDeletions,
7373
String? lastPendingDeletionId,
74+
String? snackbarHeadlineTitle,
7475
}) {
7576
return ArchivedHeadlinesState(
7677
status: status ?? this.status,
@@ -81,9 +82,9 @@ class ArchivedHeadlinesState extends Equatable {
8182
// to ensure they are cleared after being handled.
8283
exception: exception,
8384
restoredHeadline: restoredHeadline,
84-
pendingDeletions: pendingDeletions ?? this.pendingDeletions,
8585
lastPendingDeletionId:
8686
lastPendingDeletionId, // Explicitly allow null to clear
87+
snackbarHeadlineTitle: snackbarHeadlineTitle,
8788
);
8889
}
8990

@@ -95,7 +96,7 @@ class ArchivedHeadlinesState extends Equatable {
9596
hasMore,
9697
exception,
9798
restoredHeadline,
98-
pendingDeletions,
9999
lastPendingDeletionId,
100+
snackbarHeadlineTitle,
100101
];
101102
}

0 commit comments

Comments
 (0)