Skip to content

Commit

Permalink
Update data fetchers for SWR 2
Browse files Browse the repository at this point in the history
SWR 2 no longer destructures fetcher key arrays as function args. Here, we pass the Caesar parameters straight through to the data fetcher as an object.
  • Loading branch information
eatyourgreens committed Dec 19, 2022
1 parent 95d7912 commit 13f3b0c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks/useCaesar.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ASYNC_STATES from 'helpers/asyncStates'
import { config } from 'config'
import AppContext from 'stores'

async function fetchAggregations(subjectID, workflowID, extractorKey, reducerKey) {
async function fetchAggregations({ subjectID, workflowID, extractorKey, reducerKey }) {
let extractsParams = `subjectId: ${subjectID}`
let reductionsParams = `subjectId: ${subjectID}`

Expand Down Expand Up @@ -44,7 +44,7 @@ export default function useCaesar(subjectID, workflowID) {
reducerKey = taskId
}

const dataArgs = [subjectID, workflowID, extractorKey, reducerKey]
const dataArgs = { subjectID, workflowID, extractorKey, reducerKey }
const dataReady = subjectID && taskId
const { data, error } = useSWR( dataReady ? dataArgs : null, fetchAggregations)
if (error) {
Expand Down

0 comments on commit 13f3b0c

Please sign in to comment.