Skip to content

Commit

Permalink
Merge pull request #2022 from Giveth/Hotfix-2.7.1
Browse files Browse the repository at this point in the history
Hotfix 2.7.1
  • Loading branch information
alireza-sharifpour authored Jan 11, 2023
2 parents bf85cea + 6ed98af commit d5a50c6
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "givethdapp",
"version": "2.7.0",
"version": "2.7.1",
"private": true,
"scripts": {
"build": "next build",
Expand Down
1 change: 1 addition & 0 deletions src/apollo/apolloClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ function createApolloClient() {
graphQLErrors.forEach(({ message, locations, path }) => {
console.log(`[GraphQL error]: ${message}`, { locations, path });
if (message.toLowerCase().includes('authentication required')) {
console.log(Date.now(), 'sign out from graphQL');
// removes token and user from store
store.dispatch(signOut()).finally(() => {
//show signin modal
Expand Down
13 changes: 10 additions & 3 deletions src/components/views/projects/ProjectsIndex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ import { client } from '@/apollo/apolloClient';
import { ICategory, IProject } from '@/apollo/types/types';
import { IFetchAllProjects } from '@/apollo/types/gqlTypes';
import ProjectsNoResults from '@/components/views/projects/ProjectsNoResults';
import { device, deviceSize, mediaQueries } from '@/lib/constants/constants';
import {
BACKEND_QUERY_LIMIT,
device,
deviceSize,
mediaQueries,
} from '@/lib/constants/constants';
import { useAppDispatch, useAppSelector } from '@/features/hooks';
import { setShowCompleteProfile } from '@/features/modal/modal.slice';
import ProjectsBanner from './ProjectsBanner';
Expand Down Expand Up @@ -76,7 +81,9 @@ const ProjectsIndex = (props: IProjectsView) => {
(isLoadMore?: boolean, loadNum?: number, userIdChanged = false) => {
const variables: IQueries = {
limit: userIdChanged
? filteredProjects.length
? filteredProjects.length > 50
? BACKEND_QUERY_LIMIT
: filteredProjects.length
: projects.length,
skip: userIdChanged ? 0 : projects.length * (loadNum || 0),
};
Expand All @@ -85,7 +92,7 @@ const ProjectsIndex = (props: IProjectsView) => {
variables.connectedWalletUserId = Number(user?.id);
}

if (!userIdChanged) setIsLoading(true);
setIsLoading(true);
if (
contextVariables.mainCategory !== router.query?.slug?.toString()
)
Expand Down
1 change: 1 addition & 0 deletions src/features/user/user.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const initialState: {
type UserStateType = RootState['user'];

const signOutUser = (state: UserStateType) => {
console.log(Date.now(), 'signOutUser in user slice');
localStorage.removeItem(StorageLabel.USER);
localStorage.removeItem(StorageLabel.TOKEN);
const tokens = getTokens();
Expand Down
1 change: 1 addition & 0 deletions src/features/user/user.thunks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export const signOut = createAsyncThunk(
// this is in the case we fail to grab the token from local storage
// but still want to remove the whole user
if (!token) return Promise.resolve(true);
console.log(Date.now(), 'signOut in user thunk');

return await postRequest(
`${config.MICROSERVICES.authentication}/logout`,
Expand Down
2 changes: 2 additions & 0 deletions src/lib/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,5 @@ export const regenFarmStreamCardCol = {
export const TWO_WEEK = 1_209_600_000;

export const minDonationAmount = 0.000001;

export const BACKEND_QUERY_LIMIT = 50;

1 comment on commit d5a50c6

@vercel
Copy link

@vercel vercel bot commented on d5a50c6 Jan 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

giveth-dapps-v2 – ./

giveth.io
giveth-dapps-v2-givethio.vercel.app
www.giveth.io
giveth-dapps-v2-git-main-givethio.vercel.app

Please sign in to comment.