Skip to content

Commit 49d3c2c

Browse files
authored
Merge pull request #725 from WatchItDev/app/fix/login_modal_flash
feat: delete apollo cache
2 parents 8b831d0 + 6857317 commit 49d3c2c

File tree

8 files changed

+16
-12
lines changed

8 files changed

+16
-12
lines changed

src/components/follow-unfollow-button.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ const FollowUnfollowButton = ({
4343
followButtonMinWidth = 120,
4444
}: PropsWithChildren<FollowUnfollowButtonProps>) => {
4545
const dispatch = useDispatch();
46-
const [loadProfile, { data: profileData, loading: profileLoading }] = useGetUserLazyQuery({ fetchPolicy: 'cache-and-network' });
46+
const [loadProfile, { data: profileData, loading: profileLoading }] = useGetUserLazyQuery();
4747
const [toggleFollow, { loading: profileFollowLoading }] = useToggleFollowMutation();
48-
const [getIsFollowing, { data: isFollowingData, loading: isFollowingLoading }] = useGetIsFollowingLazyQuery({ fetchPolicy: 'network-only' });
48+
const [getIsFollowing, { data: isFollowingData, loading: isFollowingLoading }] = useGetIsFollowingLazyQuery();
4949
const [isFollowed, setIsFollowed] = useState(false);
5050
const [isProcessing, setIsProcessing] = useState(true);
5151
const { session } = useAuth();

src/components/publication-detail-main/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export default function PublicationDetailMain({
140140
}, [postLikedData]);
141141

142142
useEffect(() => {
143-
getIsPostLiked({ variables: { postId: post.id }, fetchPolicy: 'network-only' });
143+
getIsPostLiked({ variables: { postId: post.id } });
144144
if (post.likeCount !== undefined) {
145145
dispatch(setCounterLikes({ publicationId: post.id, likes: post.likeCount }));
146146
}

src/contexts/api/apiProvider.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ export const ApiProvider: React.FC<{ children: React.ReactNode }> = ({ children
2929
return new ApolloClient({
3030
link: concat(authLink, httpLink),
3131
cache: new InMemoryCache(),
32+
defaultOptions: {
33+
watchQuery: { fetchPolicy: 'network-only', errorPolicy: 'all' },
34+
query: { fetchPolicy: 'network-only', errorPolicy: 'all' },
35+
mutate: { errorPolicy: 'all' },
36+
},
3237
});
3338
}, [session]);
3439

src/hooks/use-account-session.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export const useAccountSession = (): UseAccountSessionHook => {
4242
const { session, isAuthLoading: reduxLoading } = useAuth();
4343
const { web3Auth } = useWeb3Auth();
4444
const dispatch = useDispatch();
45-
const [loadUser] = useGetUserLazyQuery({ fetchPolicy: 'cache-and-network' });
45+
const [loadUser] = useGetUserLazyQuery();
4646

4747
const [loginInProgress, setLoginInProgress] = useState(false);
4848
const [verifyingUser, setVerifyingUser] = useState(false);

src/hooks/use-bookmark.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ export function useBookmarks() {
99

1010
const { data, loading, refetch } = useGetUserBookmarksQuery({
1111
variables: { address, limit: 100 },
12-
skip: !address,
13-
fetchPolicy:'cache-and-network',
12+
skip: !address
1413
});
1514

1615
const idSet = useMemo(() => {

src/sections/finance/views/finance-view.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default function FinanceView() {
2121
const [percent, setPercent] = useState(0);
2222
const { session: sessionData, balance: balanceFromRedux } = useAuth();
2323
const { transactions, loading } = useGetSmartWalletTransactions();
24-
const [loadFollowing, { data: profileFollowing, loading: profileFollowingLoading }] = useGetUserFollowingLazyQuery({ fetchPolicy: 'network-only' });
24+
const [loadFollowing, { data: profileFollowing, loading: profileFollowingLoading }] = useGetUserFollowingLazyQuery();
2525
const following = profileFollowing?.getUserFollowing;
2626

2727
useEffect(() => {

src/sections/publication/components/publication-comments-list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { setRepliesCount } from '@redux/comments';
1414
export default function PostCommentList({ publicationId: id, showReplies }: Readonly<PostCommentListProps>) {
1515
const dispatch = useDispatch();
1616
const [ comments, setComments ] = useState<Comment[]>([])
17-
const [ getComments, {data, error, loading} ] = useGetCommentsByPostLazyQuery({ fetchPolicy: 'network-only' });
17+
const [ getComments, {data, error, loading} ] = useGetCommentsByPostLazyQuery();
1818
const { hiddenComments, refetchTriggerByPublication } = useSelector(
1919
(state: RootState) => state.comments
2020
);

src/sections/user/views/user-profile-view.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ const UserProfileView = ({ id }: UserProfileViewProps) => {
4343
GLOBAL_CONSTANTS.SUBSCRIPTION_POLICY_ADDRESS,
4444
session?.address as Address
4545
);
46-
const [loadProfile, { data: profileData, loading: profileDataLoading }] = useGetUserLazyQuery({ fetchPolicy: 'cache-and-network' });
47-
const [loadPublications, { data: profilePublications, loading: profilePublicationsLoading }] = useGetPostsByAuthorLazyQuery({ fetchPolicy: 'cache-and-network' });
48-
const [loadFollowers, { data: profileFollowers, loading: profileFollowersLoading }] = useGetUserFollowersLazyQuery({ fetchPolicy: 'cache-and-network' });
49-
const [loadFollowing, { data: profileFollowing, loading: profileFollowingLoading }] = useGetUserFollowingLazyQuery({ fetchPolicy: 'cache-and-network' });
46+
const [loadProfile, { data: profileData, loading: profileDataLoading }] = useGetUserLazyQuery();
47+
const [loadPublications, { data: profilePublications, loading: profilePublicationsLoading }] = useGetPostsByAuthorLazyQuery();
48+
const [loadFollowers, { data: profileFollowers, loading: profileFollowersLoading }] = useGetUserFollowersLazyQuery();
49+
const [loadFollowing, { data: profileFollowing, loading: profileFollowingLoading }] = useGetUserFollowingLazyQuery();
5050
const { invitations: referrals, fetchInvitations, loading: loadingReferrals } = useReferrals();
5151
const followersStore = useSelector((state: RootState) => state.followers.followers);
5252
const followingsStore = useSelector((state: RootState) => state.followers.followings);

0 commit comments

Comments
 (0)