mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 09:33:46 +00:00
fix: admin users search not working on pages beyond first
Separated input state (searchInput/emailSearchInput) from committed search state (search/emailSearch) to prevent every keystroke from triggering API calls with stale pagination offset.
This commit is contained in:
@@ -232,8 +232,6 @@ export default function AdminUsers() {
|
||||
|
||||
const handleSearch = (e: React.FormEvent) => {
|
||||
e.preventDefault();
|
||||
setOffset(0);
|
||||
loadUsers();
|
||||
};
|
||||
|
||||
const totalPages = Math.ceil(total / limit);
|
||||
@@ -305,7 +303,10 @@ export default function AdminUsers() {
|
||||
<input
|
||||
type="text"
|
||||
value={search}
|
||||
onChange={(e) => setSearch(e.target.value)}
|
||||
onChange={(e) => {
|
||||
setSearch(e.target.value);
|
||||
setOffset(0);
|
||||
}}
|
||||
placeholder={t('admin.users.search')}
|
||||
className="w-full rounded-xl border border-dark-700 bg-dark-800 py-2 pl-10 pr-4 text-dark-100 placeholder-dark-500 focus:border-dark-600 focus:outline-none"
|
||||
/>
|
||||
@@ -319,7 +320,10 @@ export default function AdminUsers() {
|
||||
<input
|
||||
type="email"
|
||||
value={emailSearch}
|
||||
onChange={(e) => setEmailSearch(e.target.value)}
|
||||
onChange={(e) => {
|
||||
setEmailSearch(e.target.value);
|
||||
setOffset(0);
|
||||
}}
|
||||
placeholder={t('admin.users.searchEmail')}
|
||||
className="w-full rounded-xl border border-dark-700 bg-dark-800 py-2 pl-10 pr-4 text-dark-100 placeholder-dark-500 focus:border-dark-600 focus:outline-none"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user