• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IQSS / dataverse-frontend / 7960501805

19 Feb 2024 01:42PM UTC coverage: 97.453% (-0.007%) from 97.46%
7960501805

push

github

web-flow
Merge pull request #284 from IQSS/feature/280-use-query-param-in-home-page-pagination

280 - Use page search param in home page pagination

533 of 554 branches covered (96.21%)

Branch coverage included in aggregate %.

1571 of 1605 relevant lines covered (97.88%)

3749.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

83.33
/src/sections/file/useFile.tsx
1
import { useEffect, useState } from 'react'
2
import { FileRepository } from '../../files/domain/repositories/FileRepository'
3
import { getFileById } from '../../files/domain/useCases/getFileById'
4
import { File } from '../../files/domain/models/File'
5

6
export function useFile(repository: FileRepository, id: number) {
41✔
7
  const [file, setFile] = useState<File>()
41✔
8
  const [isLoading, setIsLoading] = useState<boolean>(true)
41✔
9

10
  useEffect(() => {
41✔
11
    setIsLoading(true)
14✔
12

13
    getFileById(repository, id)
14✔
14
      .then((file: File | undefined) => {
15
        setFile(file)
14✔
16
        setIsLoading(false)
14✔
17
      })
18
      .catch(() => {
19
        throw new Error('There was an error getting the file')
×
20
        setIsLoading(false)
×
21
      })
22
  }, [repository, id])
23

24
  return {
41✔
25
    file,
26
    isLoading
27
  }
28
}
5✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc