Declare scoped presence dependency for agent mention picker

Signed-off-by: Tom Brow <tomb@block.xyz>
This commit is contained in:
Tom Brow
2026-10-19 16:25:40 -07:00
parent 928d4863d5
commit 1783bbca70
2 changed files with 21 additions and 1 deletions

View File

@@ -229,7 +229,7 @@ final mentionCandidatesProvider = Provider.family
history: ref.watch(mentionHistoryProvider)[args.channelId] ?? const {},
presence: (key) => presence[key] ?? 'unknown',
);
});
}, dependencies: [presentedPresenceProvider]);
/// Picker labels compare every selectable choice, before query ranking
/// filters them, so a row's label does not change as the query narrows.

View File

@@ -1,3 +1,4 @@
import 'package:buzz/shared/agents/agents_surface.dart';
import 'dart:async';
import 'package:flutter_test/flutter_test.dart';
@@ -129,6 +130,25 @@ void main() {
await container.read(channelsProvider.future);
});
test('picker supports prototype-scoped remote availability', () async {
final scoped = ProviderContainer(
parent: container,
overrides: [
availableRemoteAgentsProvider.overrideWithValue({_alice}),
],
);
addTearDown(scoped.dispose);
final provider = mentionCandidatesProvider((
channelId: _channelId,
query: '',
opening: 2,
));
final listener = scoped.listen(provider, (_, _) {});
addTearDown(listener.close);
await scoped.pump();
expect(() => scoped.read(provider), returnsNormally);
});
Future<void> passTypingPause() async {
await Future<void>.delayed(mentionSearchDebounce * 2);
await container.pump();