mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
🐛 Fixed user list behaviour after deletion (#18738)
refs https://github.com/TryGhost/Product/issues/3831 The wrong logic was used to fetch the next page, making the remaining users show twice after deleting. Also fixed the route not updating after deletion. --- <!-- Leave the line below if you'd like GitHub Copilot to generate a summary from your commit --> <!-- copilot:summary --> ### <samp>🤖 Generated by Copilot at 82a41fc</samp> Refactor and improve `UserDetailModal` component with React Query, TypeScript, and UX enhancements. Fix data bug and add navigation feature.
This commit is contained in:
parent
2c72c93331
commit
80392500bb
1 changed files with 2 additions and 1 deletions
|
@ -162,6 +162,7 @@ const UserDetailModalContent: React.FC<{user: User}> = ({user}) => {
|
|||
await deleteUser(_user?.id);
|
||||
modal?.remove();
|
||||
mainModal?.remove();
|
||||
navigateOnClose();
|
||||
showToast({
|
||||
message: 'User deleted',
|
||||
type: 'success'
|
||||
|
@ -505,7 +506,7 @@ const UserDetailModal: React.FC<RoutingModalProps> = ({params}) => {
|
|||
const user = currentUser.slug === params?.slug ? currentUser : users.find(({slug}) => slug === params?.slug);
|
||||
|
||||
useEffect(() => {
|
||||
if (!user && !hasNextPage) {
|
||||
if (!user && hasNextPage) {
|
||||
fetchNextPage();
|
||||
}
|
||||
}, [fetchNextPage, hasNextPage, user]);
|
||||
|
|
Loading…
Add table
Reference in a new issue