@@ -506,7 +506,11 @@ void main() {
506506 () async {
507507 final relaySession = _RecordingRelaySessionNotifier (
508508 queryResults: [
509- [_event (id: 'root' , createdAt: 10 ), _bounds ()],
509+ [
510+ _event (id: 'root' , createdAt: 10 ),
511+ _summary (rootId: 'root' , replyCount: 1 ),
512+ _bounds (),
513+ ],
510514 ],
511515 );
512516 final container = _buildContainer (relaySession);
@@ -4314,6 +4318,69 @@ void main() {
43144318 );
43154319 }
43164320
4321+ for (final newReplyExists in [false , true ]) {
4322+ test (
4323+ 'live summary after empty older page is reconciled (new reply: $newReplyExists )' ,
4324+ () async {
4325+ final recount = Completer <List <NostrEvent >>();
4326+ final session = _RecordingRelaySessionNotifier (
4327+ queryResults: [
4328+ [
4329+ _event (id: 'newest' , createdAt: 100 ),
4330+ _bounds (hasMore: true , cursorCreatedAt: 100 , cursorId: 'newest' ),
4331+ ],
4332+ [
4333+ _event (id: 'root' , createdAt: 10 ),
4334+ _bounds (dTag: '${_channelId .toLowerCase ()}:100:newest' ),
4335+ ],
4336+ recount.future,
4337+ ],
4338+ );
4339+ final container = _buildContainer (session);
4340+ addTearDown (container.dispose);
4341+ container.listen (channelMessagesProvider (_channelId), (_, _) {});
4342+ await _pumpEventQueue ();
4343+ final notifier = container.read (
4344+ channelMessagesProvider (_channelId).notifier,
4345+ );
4346+ expect (await notifier.fetchOlder (), isTrue);
4347+ session.emit (_summary (rootId: 'root' , replyCount: 1 ));
4348+ expect (notifier.threadSummaries['root' ]! .descendantCount, 0 );
4349+ await Future <void >.delayed (const Duration (milliseconds: 300 ));
4350+ expect (
4351+ session.queryFilters.where (
4352+ (f) => f.extensions.containsKey ('depth_limit' ),
4353+ ),
4354+ hasLength (1 ),
4355+ );
4356+ recount.complete ([
4357+ if (newReplyExists)
4358+ _event (
4359+ id: 'new-reply' ,
4360+ createdAt: 30 ,
4361+ extraTags: const [
4362+ ['e' , 'root' , '' , 'reply' ],
4363+ ],
4364+ ),
4365+ ]);
4366+ await _pumpEventQueue ();
4367+ final entries = buildMainTimelineEntries (
4368+ formatTimeline (
4369+ container.read (channelMessagesProvider (_channelId)).value! ,
4370+ ),
4371+ relaySummaries: notifier.threadSummaries,
4372+ );
4373+ expect (
4374+ entries
4375+ .singleWhere ((e) => e.message.id == 'root' )
4376+ .summary
4377+ ? .replyCount,
4378+ newReplyExists ? 1 : null ,
4379+ );
4380+ },
4381+ );
4382+ }
4383+
43174384 for (final newReplyExists in [false , true ]) {
43184385 test (
43194386 'live summary after empty scan is reconciled (new reply: $newReplyExists )' ,
0 commit comments