mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix error on unmount in syncplay menu
This commit is contained in:
parent
dbd068b3e1
commit
55a2ca3590
1 changed files with 8 additions and 1 deletions
|
@ -56,9 +56,12 @@ const SyncPlayMenu: FC<SyncPlayMenuProps> = ({
|
|||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let isMounted = true;
|
||||
|
||||
const fetchGroups = async () => {
|
||||
if (api) {
|
||||
setGroups((await getSyncPlayApi(api).syncPlayGetGroups()).data);
|
||||
const response = await getSyncPlayApi(api).syncPlayGetGroups();
|
||||
if (isMounted) setGroups(response.data);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -66,6 +69,10 @@ const SyncPlayMenu: FC<SyncPlayMenuProps> = ({
|
|||
.catch(err => {
|
||||
console.error('[SyncPlayMenu] unable to fetch SyncPlay groups', err);
|
||||
});
|
||||
|
||||
return () => {
|
||||
isMounted = false;
|
||||
};
|
||||
}, [ api ]);
|
||||
|
||||
const onGroupAddClick = useCallback(() => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue