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

IQSS / dataverse-frontend / 7478270980

08 Jan 2024 03:20PM UTC coverage: 97.854% (-0.07%) from 97.922%
7478270980

Pull #260

github

web-flow
Merge pull request #271 from IQSS/feature/262-file-labels-section-of-the-file-page

262 - File labels section of the File page
Pull Request #260: 249 - File Page boilerplate

471 of 486 branches covered (0.0%)

Branch coverage included in aggregate %.

1535 of 1564 relevant lines covered (98.15%)

4021.68 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) {
31✔
7
  const [file, setFile] = useState<File>()
31✔
8
  const [isLoading, setIsLoading] = useState<boolean>(true)
31✔
9

10
  useEffect(() => {
31✔
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 {
31✔
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

© 2026 Coveralls, Inc