jotai migration (#221)

This commit is contained in:
Marco Piovanello
2024-11-12 11:31:25 +01:00
committed by GitHub
parent 4a87ea559a
commit 01c6edef74
37 changed files with 287 additions and 408 deletions

View File

@@ -1,14 +1,10 @@
import { atom, selector } from 'recoil'
import { atom } from 'jotai'
import { activeDownloadsState } from './downloads'
export const loadingAtom = atom({
key: 'loadingAtom',
default: true
})
export const loadingAtom = atom(true)
export const totalDownloadSpeedState = selector<number>({
key: 'totalDownloadSpeedState',
get: ({ get }) => get(activeDownloadsState)
export const totalDownloadSpeedState = atom<number>((get) =>
get(activeDownloadsState)
.map(d => d.progress.speed)
.reduce((curr, next) => curr + next, 0)
})
)