🐛 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:
@@ -455,6 +455,7 @@ export default function ModelSettingsVisualEditor(props) {
|
||||
setCurrentPage(1);
|
||||
}}
|
||||
style={{ width: 200 }}
|
||||
showClear
|
||||
/>
|
||||
<Checkbox
|
||||
checked={conflictOnly}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user