🐛 fix(ratio-sync): reset pagination when filter/search changes

Add a `useEffect` hook in `UpstreamRatioSync.js` to automatically set
`currentPage` to `1` whenever `ratioTypeFilter` or `searchKeyword`
updates.
This prevents the table from appearing empty when users switch to the
“model_price” (fixed price) filter or perform a new search while on a
later page.

Additional changes:
- Import `useEffect` from React.

This enhancement delivers a smoother UX by ensuring the first page of
results is always shown after any filtering action.
This commit is contained in:
t0ng7u
2025-06-23 16:34:00 +08:00
parent 5367015a31
commit c28190316f
2 changed files with 6 additions and 1 deletions

View File

@@ -455,6 +455,7 @@ export default function ModelSettingsVisualEditor(props) {
setCurrentPage(1);
}}
style={{ width: 200 }}
showClear
/>
<Checkbox
checked={conflictOnly}

View File

@@ -1,4 +1,4 @@
import React, { useState, useCallback, useMemo } from 'react';
import React, { useState, useCallback, useMemo, useEffect } from 'react';
import {
Button,
Table,
@@ -58,6 +58,10 @@ export default function UpstreamRatioSync(props) {
const channelSelectorRef = React.useRef(null);
useEffect(() => {
setCurrentPage(1);
}, [ratioTypeFilter, searchKeyword]);
const fetchAllChannels = async () => {
setLoading(true);
try {