File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
components/EditProfilePage Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -46,8 +46,10 @@ export function FollowingTab({ className }: { className?: string }) {
46
46
// doc.data() is never undefined for query doc snapshots
47
47
billList . push ( doc . data ( ) . billLookup )
48
48
} )
49
- setBillsFollowing ( billList )
50
- } , [ subscriptionRef , uid ] )
49
+ if ( billsFollowing . length === 0 && billList . length != 0 ) {
50
+ setBillsFollowing ( billList )
51
+ } // this limits the code from falling into an infinite loop
52
+ } , [ subscriptionRef , uid , billsFollowing ] )
51
53
52
54
useEffect ( ( ) => {
53
55
uid ? billsFollowingQuery ( ) : null
@@ -69,7 +71,7 @@ export function FollowingTab({ className }: { className?: string }) {
69
71
70
72
if ( usersFollowing . length === 0 && usersList . length != 0 ) {
71
73
setUsersFollowing ( usersList )
72
- }
74
+ } // this limits the code from falling into an infinite loop
73
75
} , [ subscriptionRef , uid , usersFollowing ] )
74
76
75
77
const fetchFollowedItems = useCallback ( async ( ) => {
You can’t perform that action at this time.
0 commit comments