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

zooniverse / front-end-monorepo / 16529320833

25 Jul 2025 06:47PM UTC coverage: 77.447% (-0.4%) from 77.896%
16529320833

Pull #6958

github

web-flow
Merge 5e9568c9a into 1609d4670
Pull Request #6958: lib-react-components: Add FavoritesIconButton component and useUserCollections hook

11349 of 17140 branches covered (66.21%)

Branch coverage included in aggregate %.

63 of 137 new or added lines in 13 files covered. (45.99%)

17572 of 20203 relevant lines covered (86.98%)

397.48 hits per line

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

11.54
/packages/lib-react-components/src/hooks/useUserCollections.js
1
import { collections } from '@zooniverse/panoptes-js'
1✔
2
import useSWR from 'swr'
1!
3

4
import usePanoptesAuthToken from './usePanoptesAuthToken'
2!
5

6
const SWRoptions = {
1✔
7
  revalidateIfStale: true,
8
  revalidateOnMount: true,
9
  revalidateOnFocus: true,
10
  revalidateOnReconnect: true,
11
  refreshInterval: 0
12
}
13

NEW
14
async function fetchUserCollections({ query, token }) {
×
NEW
15
  const authorization = `Bearer ${token}`
×
16

NEW
17
  const response = await collections.get({ authorization, query })
×
18
  
NEW
19
  return response?.body?.collections
×
NEW
20
}
×
21

NEW
22
export default function useUserCollections({ query }) {
×
NEW
23
  const token = usePanoptesAuthToken()
×
NEW
24
  const key = token ? { query, token } : null
×
25

NEW
26
  return useSWR(key, fetchUserCollections, SWRoptions)
×
27
}
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