Skip to content

Commit

Permalink
fix: missing deps
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrader committed May 9, 2023
1 parent 7ef054d commit ea62aeb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/context/auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
}

setInitialLoad(true)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

useEffect(() => {
Expand All @@ -158,7 +159,7 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
if (initialLoad) {
setLoading(loadingUser)
}
}, [loadingUser])
}, [initialLoad, loadingUser])

return (
<AuthContext.Provider
Expand Down
8 changes: 3 additions & 5 deletions src/hooks/useFundingFormState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,14 @@ export type UpdateReward = (_: IRewardCount) => void

export interface IFundFormState {
state: IFundForm

setTarget: (event: any) => void

setState: (name: string, value: any) => void
updateReward: UpdateReward
resetForm: () => void
}

export const useFundingFormState = ({ rewards }: UseFundStateProps) => {
const { user } = useContext(AuthContext)
const { user, isAnonymous } = useContext(AuthContext)
const { getUSDCentsAmount } = useBTCConverter()

const initialState: IFundForm = useMemo(
Expand All @@ -52,15 +50,15 @@ export const useFundingFormState = ({ rewards }: UseFundStateProps) => {
comment: '',
shippingDestination: ShippingDestination.National,
shippingCost: 0,
anonymous: !(user && user.id), // The default user has id 0
anonymous: isAnonymous, // The default user has id 0
funderAvatarURL: user.imageUrl || '',
funderUsername: user.username,
email: '',
media: '',
rewardsByIDAndCount: undefined,
rewardCurrency: RewardCurrency.Usdcent,
}),
[user],
[isAnonymous, user.imageUrl, user.username],
)

const [state, _setState] = useState<IFundForm>(initialState)
Expand Down

0 comments on commit ea62aeb

Please sign in to comment.