@@ -134,10 +134,9 @@ export default function AdminUsersPage() {
134134
135135 const fetchUsers = useCallback ( async ( force = false ) => {
136136 setErr ( '' ) ;
137- const keyNow = JSON . stringify ( {
138- page, q : query , sort : sortDescriptor ,
139- } ) ;
140- if ( ! force && lastQueryRef . current === keyNow ) return ;
137+ const myKey = JSON . stringify ( { page, q : query , sort : sortDescriptor } ) ;
138+ if ( ! force && lastQueryRef . current === myKey ) return ;
139+ lastQueryRef . current = myKey ;
141140
142141 setLoading ( true ) ;
143142 try {
@@ -154,7 +153,6 @@ export default function AdminUsersPage() {
154153
155154 let content = Array . isArray ( pageData ?. content ) ? pageData . content : [ ] ;
156155
157- // ROLE 정렬일 때, 알파벳 대신 권한 서열로 보정 (페이지 내 안정화)
158156 if ( sortDescriptor . column === 'userRole' ) {
159157 const asc = sortDescriptor . direction !== 'descending' ;
160158 content = content . slice ( ) . sort ( ( a , b ) => {
@@ -163,14 +161,15 @@ export default function AdminUsersPage() {
163161 } ) ;
164162 }
165163
164+ if ( lastQueryRef . current !== myKey ) return ;
165+
166166 setRows ( content ) ;
167167
168168 const total = meta ?. totalElements ?? pageData ?. totalElements ?? content . length ;
169169 setTotalUsers ( total ) ;
170170 setTotalPages ( Math . max ( 1 , Math . ceil ( total / rowsPerPage ) ) ) ;
171- lastQueryRef . current = keyNow ;
172171 } catch ( e ) {
173- setErr ( e ?. message || '사용자 목록을 불러오지 못했습니다.' ) ;
172+ setErr ( e ?. response ?. data ?. message || e ?. message || '사용자 목록을 불러오지 못했습니다.' ) ;
174173 setRows ( [ ] ) ;
175174 setTotalUsers ( 0 ) ;
176175 setTotalPages ( 1 ) ;
0 commit comments