fix(app): leave tabs that open a deleted page by title, so it is not recreated

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
dasemuandClaude Opus 5.5 committed 2026-10-26 03:57:49 +01:00
1 parent 3d754a83e6
commit a6d566ff6f
4 files changed
+22 -4

No files matched your search

+11 -2
View File
@@ -485,9 +485,18 @@ class AppState extends ChangeNotifier {
/// Pages were deleted: tabs showing them step back to the last surviving entry (or
/// Journals) and the recents drop them.
void pagesDeleted(Iterable<String> ids) {
///
/// Routes that open a page by title count too: left open, they would recreate it.
void pagesDeleted(
Iterable<String> ids, {
Iterable<String> titles = const [],
}) {
final gone = ids.toSet();
bool dead(AppRoute r) => r is PageTarget && gone.contains(r.id);
final goneTitles = {for (final t in titles) t.toLowerCase()};
bool dead(AppRoute r) =>
r is PageTarget &&
(gone.contains(r.id) ||
(r.title != null && goneTitles.contains(r.title!.toLowerCase())));
recent.removeWhere((p) => gone.contains(p.id));
for (final t in _tabs) {
t.back.removeWhere(dead);