refactor(desktop): reorganize workspace panels and navigation
This commit is contained in:
1 parent
826745b407
commit
1f73765745
92 files changed
+5811
-2650
No files matched your search
@@ -59,6 +59,8 @@ class _Repository extends ConversationRepository {
|
||||
_Repository() : super(Directory('/unused'));
|
||||
Completer<List<ConversationMetadata>>? blocked;
|
||||
final started = Completer<void>();
|
||||
int groupReads = 0;
|
||||
Completer<List<ConversationMetadata>>? blockedTrash;
|
||||
bool fail = false;
|
||||
bool failDelete = false;
|
||||
final trashed = <ConversationMetadata>[];
|
||||
@@ -69,7 +71,8 @@ class _Repository extends ConversationRepository {
|
||||
String projectId, {
|
||||
bool trash = false,
|
||||
}) async {
|
||||
if (trash) return List.of(trashed);
|
||||
if (trash) return blockedTrash?.future ?? Future.value(List.of(trashed));
|
||||
groupReads++;
|
||||
if (fail) throw StateError('read failed');
|
||||
if (projectId == 'a' && blocked != null) {
|
||||
if (!started.isCompleted) started.complete();
|
||||
@@ -267,6 +270,29 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
test(
|
||||
'project switching keeps groups visible without rereading their listings',
|
||||
() async {
|
||||
final initial = container.read(conversationSidebarProvider).requireValue;
|
||||
final reads = repository.groupReads;
|
||||
repository.blockedTrash = Completer();
|
||||
(container.read(projectsProvider.notifier) as _Projects).selectProject(1);
|
||||
await container.pump();
|
||||
final switching = container.read(conversationSidebarProvider);
|
||||
expect(switching.isLoading, isFalse);
|
||||
expect(switching.requireValue.groups['a'], same(initial.groups['a']));
|
||||
expect(switching.requireValue.groups['b'], same(initial.groups['b']));
|
||||
expect(repository.groupReads, reads);
|
||||
repository.blockedTrash!.complete([]);
|
||||
await container.pump();
|
||||
expect(
|
||||
container.read(conversationSidebarProvider).requireValue.projectId,
|
||||
'b',
|
||||
);
|
||||
expect(repository.groupReads, reads);
|
||||
},
|
||||
);
|
||||
|
||||
test('reopening a project reloads its saved selection', () async {
|
||||
final provider = conversationSelectionProvider('a');
|
||||
container.listen(provider, (_, _) {});
|
||||
|
||||
Reference in new issue
Block a user