mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
fixed memory leak
This commit is contained in:
@@ -36,7 +36,7 @@ export const useUpdateCache = hash => {
|
||||
return cache
|
||||
}
|
||||
|
||||
export const useCreateCacheMap = (cache, callback) => {
|
||||
export const useCreateCacheMap = cache => {
|
||||
const [cacheMap, setCacheMap] = useState([])
|
||||
|
||||
useEffect(() => {
|
||||
@@ -67,8 +67,7 @@ export const useCreateCacheMap = (cache, callback) => {
|
||||
}
|
||||
|
||||
setCacheMap(map)
|
||||
callback && callback()
|
||||
}, [cache, callback])
|
||||
}, [cache])
|
||||
|
||||
return cacheMap
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { NoImageIcon } from 'icons'
|
||||
import { getPeerString, humanizeSize } from 'utils/Utils'
|
||||
import { viewedHost } from 'utils/Hosts'
|
||||
import { CopyToClipboard } from 'react-copy-to-clipboard'
|
||||
import { useState } from 'react'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import { useUpdateCache, useCreateCacheMap } from './customHooks'
|
||||
|
||||
@@ -116,7 +116,9 @@ export default function DialogTorrentDetailsContent({ closeDialog, torrent }) {
|
||||
} = torrent
|
||||
|
||||
const cache = useUpdateCache(hash)
|
||||
const cacheMap = useCreateCacheMap(cache, () => setIsLoading(false))
|
||||
const cacheMap = useCreateCacheMap(cache)
|
||||
|
||||
useEffect(() => setIsLoading(false), [cacheMap])
|
||||
|
||||
const { Capacity, PiecesCount, PiecesLength } = cache
|
||||
|
||||
|
||||
Reference in New Issue
Block a user