🐛 fix(models): export setActivePage to prevent tab-change TypeError

Context:
Clicking a vendor tab triggered “setActivePage is not a function” from ModelsTabs.jsx:43.

Root cause:
ModelsTabs expects `setActivePage` via props (spread from `useModelsData`), but the hook did not expose it in its return object, so the prop resolved to `undefined`.

Fix:
Export `setActivePage` from `useModelsData`’s return object so `ModelsTabs` receives a valid function.

Result:
Tab switching now correctly resets pagination to page 1 and reloads models without runtime errors.

Files:
- web/src/hooks/models/useModelsData.jsx

Test plan:
- Open the Models page
- Click different vendor tabs
- Verify no crash occurs and the list reloads with page reset to 1

Refs: web/src/components/table/models/ModelsTabs.jsx:43
This commit is contained in:
t0ng7u
2025-09-06 21:57:26 +08:00
parent 3d0bf36981
commit e5a5d2de7c

View File

@@ -462,6 +462,7 @@ export const useModelsData = () => {
copyText,
// Pagination
setActivePage,
handlePageChange,
handlePageSizeChange,