Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(skills): drive the registry pager from the requested page (#7082)

oxoxDev21949426e937
diff --git a/app/src/components/skills/SkillsExplorerTab.tsx b/app/src/components/skills/SkillsExplorerTab.tsx
index 626a47f4f1..f74592f7e5 100644
--- a/app/src/components/skills/SkillsExplorerTab.tsx
+++ b/app/src/components/skills/SkillsExplorerTab.tsx
@@ -1138,7 +1138,7 @@ export default function SkillsExplorerTab({ onToast, view }: SkillsExplorerTabPr
: undefined
}
pagination={{
- page: catalogPage?.page ?? catalogPageNum,
+ page: catalogPageNum,
pageSize: catalogPageSize,
total: catalogPage?.total,
onPageChange: setCatalogPageNum,
diff --git a/app/src/components/skills/__tests__/SkillsExplorerTab.test.tsx b/app/src/components/skills/__tests__/SkillsExplorerTab.test.tsx
index 78e045a379..aee3224261 100644
--- a/app/src/components/skills/__tests__/SkillsExplorerTab.test.tsx
+++ b/app/src/components/skills/__tests__/SkillsExplorerTab.test.tsx
@@ -235,6 +235,45 @@ describe('SkillsExplorerTab', () => {
expect(tileCount()).toBe(5);
});
+ it('advances the pager from the requested page while a page is still loading', async () => {
+ const { skillsApi } = await import('../../../services/api/skillsApi');
+ const { skillRegistryApi } = await import('../../../services/api/skillRegistryApi');
+ vi.mocked(skillsApi.listWorkflows).mockResolvedValue([]);
+ const entries: CatalogEntry[] = Array.from({ length: 130 }, (_, i) => ({
+ ...MOCK_CATALOG_ENTRY,
+ id: `slow-skill-${i}`,
+ name: `Slow Skill ${i}`,
+ }));
+ await serveCatalog(entries);
+
+ render(
+ <MemoryRouter>
+ <SkillsPage initialTab="registry" />
+ </MemoryRouter>
+ );
+
+ await waitFor(() => {
+ expect(screen.getByText('Slow Skill 0')).toBeInTheDocument();
+ });
+
+ vi.mocked(skillRegistryApi.browsePage).mockImplementation(() => new Promise(() => {}));
+ const pager = screen.getByTestId('registry-pagination');
+
+ await act(async () => {
+ fireEvent.click(within(pager).getByRole('button', { name: 'Next page' }));
+ });
+ await act(async () => {
+ fireEvent.click(within(pager).getByRole('button', { name: 'Next page' }));
+ });
+
+ expect(skillRegistryApi.browsePage).toHaveBeenCalledWith(
+ expect.objectContaining({ page: 2, pageSize: 25 })
+ );
+ expect(skillRegistryApi.browsePage).toHaveBeenLastCalledWith(
+ expect.objectContaining({ page: 3, pageSize: 25 })
+ );
+ });
+
it('searches catalog via RPC when typing in search box', async () => {
const { skillsApi } = await import('../../../services/api/skillsApi');
const { skillRegistryApi } = await import('../../../services/api/skillRegistryApi');