Skip to content

Commit

Permalink
fix: set initials isLoading according to config.immediate
Browse files Browse the repository at this point in the history
  • Loading branch information
JuroUhlar committed Mar 14, 2024
1 parent a301da9 commit bf52bd1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/use-visitor-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function useVisitorData<TExtended extends boolean>(
const { immediate } = config
const { getVisitorData } = useContext<FpjsContextInterface<TExtended>>(FpjsContext)

const initialState = { isLoading: false }
const initialState = { isLoading: config.immediate ? true : false }
const [state, setState] = useState<QueryResult<VisitorData<TExtended>>>(initialState)

const getData = useCallback<VisitorQueryContext<TExtended>['getData']>(
Expand Down

0 comments on commit bf52bd1

Please sign in to comment.