diff --git a/src/components/UserList/JellyfinImportModal.tsx b/src/components/UserList/JellyfinImportModal.tsx index c3cf12a5f..c57e06516 100644 --- a/src/components/UserList/JellyfinImportModal.tsx +++ b/src/components/UserList/JellyfinImportModal.tsx @@ -51,6 +51,18 @@ const JellyfinImportModal: React.FC = ({ revalidateOnMount: true, }); + const { data: existingUsers } = useSWR( + `/api/v1/user?take=${children}` + ); + + data?.forEach((user, pos) => { + if ( + existingUsers?.results.some((data) => data.jellyfinUserId === user.id) + ) { + data?.splice(pos, 1); + } + }); + const importUsers = async () => { setImporting(true); @@ -119,20 +131,6 @@ const JellyfinImportModal: React.FC = ({ } }; - const { data: existingUsers } = useSWR( - `/api/v1/user?take=${children}` - ); - - data?.forEach((user, pos) => { - if ( - existingUsers?.results.some( - (existingUser) => existingUser.jellyfinUserId === user.id - ) - ) { - delete data[pos]; - } - }); - return (