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

IQSS / dataverse-frontend / 24205537621

06 Apr 2026 03:35PM UTC coverage: 97.365% (-0.7%) from 98.063%
24205537621

push

github

web-flow
Merge pull request #940 from IQSS/UseCollectionRepository

Avoid prop-drilling for collection repository

4361 of 4566 branches covered (95.51%)

Branch coverage included in aggregate %.

27 of 27 new or added lines in 23 files covered. (100.0%)

53 existing lines in 22 files now uncovered.

8570 of 8715 relevant lines covered (98.34%)

10190.49 hits per line

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

88.89
/src/sections/collection/useCollection.tsx
1
import { CollectionRepository } from '../../collection/domain/repositories/CollectionRepository'
2
import { Collection } from '../../collection/domain/models/Collection'
3
import { useCallback, useEffect, useState } from 'react'
4
import { getCollectionById } from '../../collection/domain/useCases/getCollectionById'
5

6
export function useCollection(
7
  collectionRepository: CollectionRepository,
8
  collectionId?: string | undefined
9
) {
10
  const [isLoading, setIsLoading] = useState(true)
1,499✔
11
  const [collection, setCollection] = useState<Collection>()
1,499✔
12

424✔
13
  const getCollection = useCallback(() => {
1,075✔
14
    setIsLoading(true)
867✔
15
    setCollection(undefined)
628✔
16
    getCollectionById(collectionRepository, collectionId)
628✔
17
      .then((collection: Collection) => {
185✔
18
        setCollection(collection)
443✔
19
      })
185✔
20
      .catch((error) => {
UNCOV
21
        console.error('There was an error getting the collection', error)
×
22
      })
×
23
      .finally(() => {
24
        setIsLoading(false)
443✔
25
      })
185✔
26
  }, [collectionRepository, collectionId])
27

28
  useEffect(() => {
1,075✔
29
    getCollection()
867✔
30
  }, [getCollection])
48✔
31

32
  return { collection, isLoading, refetchCollection: getCollection }
1,075✔
33
}
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