Skip to content

Commit eaa7ec2

Browse files
google-genai-botcopybara-github
authored andcommitted
ADK changes
PiperOrigin-RevId: 853778465
1 parent 9f75959 commit eaa7ec2

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

src/app/components/session-tab/session-tab.component.spec.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ describe('SessionTabComponent', () => {
4949
sessionService = new MockSessionService();
5050
mockUiStateService = new MockUiStateService();
5151
mockFeatureFlagService = new MockFeatureFlagService();
52+
mockFeatureFlagService.isInfinityMessageScrollingEnabledResponse.next(false);
5253

5354
sessionService.listSessionsResponse.next({
5455
items: [],
@@ -369,6 +370,37 @@ describe('SessionTabComponent', () => {
369370
});
370371
});
371372
});
373+
374+
describe('when infinity scrolling is enabled', () => {
375+
beforeEach(() => {
376+
mockFeatureFlagService.isInfinityMessageScrollingEnabledResponse.next(
377+
true);
378+
sessionService.getSessionResponse.next({} as any);
379+
component.reloadSession('session1');
380+
});
381+
382+
it('fetches session with pagination params', () => {
383+
expect(sessionService.getSession)
384+
.toHaveBeenCalledWith(
385+
component.userId, component.appName, 'session1',
386+
{pageSize: 100, pageToken: ''});
387+
});
388+
});
389+
390+
describe('when infinity scrolling is disabled', () => {
391+
beforeEach(() => {
392+
mockFeatureFlagService.isInfinityMessageScrollingEnabledResponse.next(
393+
false);
394+
sessionService.getSessionResponse.next({} as any);
395+
component.reloadSession('session1');
396+
});
397+
398+
it('fetches session without pagination params', () => {
399+
expect(sessionService.getSession)
400+
.toHaveBeenCalledWith(
401+
component.userId, component.appName, 'session1', undefined);
402+
});
403+
});
372404
});
373405

374406
describe('on refresh', () => {

src/app/components/session-tab/session-tab.component.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import {MatInputModule} from '@angular/material/input';
2525
import {MatProgressBar} from '@angular/material/progress-bar';
2626
import {ActivatedRoute} from '@angular/router';
2727
import {of, Subject} from 'rxjs';
28-
import {catchError, debounceTime, map, switchMap, tap,} from 'rxjs/operators';
28+
import {catchError, debounceTime, map, switchMap, tap, withLatestFrom} from 'rxjs/operators';
2929

3030
import {Session} from '../../core/models/Session';
3131
import {FEATURE_FLAG_SERVICE} from '../../core/services/interfaces/feature-flag';
@@ -171,10 +171,16 @@ export class SessionTabComponent implements OnInit {
171171

172172
this.reloadSessionSubject
173173
.pipe(
174+
withLatestFrom(
175+
this.featureFlagService.isInfinityMessageScrollingEnabled()),
174176
switchMap(
175-
(sessionId) =>
177+
([sessionId, isInfinityScrollingEnabled]) =>
176178
this.sessionService
177-
.getSession(this.userId, this.appName, sessionId)
179+
.getSession(
180+
this.userId, this.appName, sessionId,
181+
isInfinityScrollingEnabled ?
182+
{pageSize: 100, pageToken: ''} :
183+
undefined)
178184
.pipe(catchError(() => of(null)))),
179185
tap((res) => {
180186
if (!res) return;

0 commit comments

Comments
 (0)