Skip to content

Commit

Permalink
refactor(src): ⚡ optimize ISR times
Browse files Browse the repository at this point in the history
  • Loading branch information
Nudelsuppe42 committed Apr 21, 2024
1 parent 684ec93 commit 4a4f6f2
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/pages/gallery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ export async function getStaticProps({ locale }: any) {
data: res,
...(await serverSideTranslations(locale, ['common'])),
},
revalidate: 60 * 60 * 12, // Every 12 hours
revalidate: 60 * 60, // Every hour
};
}
2 changes: 1 addition & 1 deletion src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,6 @@ export async function getStaticProps({ locale }: any) {
headData: res2.sort((a: any, b: any) => 0.5 - Math.random()),
...(await serverSideTranslations(locale, ['common', 'home'])),
},
revalidate: 60 * 2, // Every two minutes
revalidate: 60 * 10, // Every 10 minutes
};
}
3 changes: 2 additions & 1 deletion src/pages/teams/[team]/apply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ import { useTranslation } from 'react-i18next';
import sanitize from 'sanitize-html';
import Page from '../../../components/Page';
import { useUser } from '../../../hooks/useUser';
import { ApplicationQuestions } from '../../../utils/application/ApplicationQuestions';
import fetcher from '../../../utils/Fetcher';
import { ApplicationQuestions } from '../../../utils/application/ApplicationQuestions';

const Apply: NextPage = ({ data, buildteam }: any) => {
const router = useRouter();
Expand Down Expand Up @@ -269,6 +269,7 @@ export async function getStaticProps({ locale, params }: any) {
buildteam: res2,
...(await serverSideTranslations(locale, ['common', 'teams'])),
},
revalidate: 60 * 60 * 24, // Every day,
};
}
export async function getStaticPaths() {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/teams/[team]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export async function getStaticProps({ locale, params }: any) {
data: res,
data2: res2,
},
revalidate: 60 * 60 * 2, // Every 2 hours,
revalidate: 60 * 20, // Every 20 minutes,
};
}
export async function getStaticPaths() {
Expand Down
25 changes: 13 additions & 12 deletions src/pages/teams/[team]/manage/apply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ import {
Title,
useMantineTheme,
} from '@mantine/core';
import {
ApplicationQuestions,
toReadable,
} from '../../../../utils/application/ApplicationQuestions';
import {
IconCheck,
IconChevronDown,
Expand All @@ -27,20 +23,24 @@ import {
IconPlus,
} from '@tabler/icons-react';
import Question, { EditQuestion } from '../../../../components/application/questions/Question';
import {
ApplicationQuestions,
toReadable,
} from '../../../../utils/application/ApplicationQuestions';

import Icon from '../../../../components/Icon';
import Link from 'next/link';
import { showNotification } from '@mantine/notifications';
import { NextPage } from 'next';
import Page from '../../../../components/Page';
import SettingsTabs from '../../../../components/SettingsTabs';
import fetcher from '../../../../utils/Fetcher';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { showNotification } from '@mantine/notifications';
import thumbnail from '../../../../../public/images/thumbnails/teams.png';
import Link from 'next/link';
import { useRouter } from 'next/router';
import { useState } from 'react';
import { useUser } from '../../../../hooks/useUser';
import { v4 as uuidv4 } from 'uuid';
import thumbnail from '../../../../../public/images/thumbnails/teams.png';
import Icon from '../../../../components/Icon';
import Page from '../../../../components/Page';
import SettingsTabs from '../../../../components/SettingsTabs';
import { useUser } from '../../../../hooks/useUser';
import fetcher from '../../../../utils/Fetcher';

const Apply: NextPage = ({ data: tempData, team }: any) => {
const [trial, setTrial] = useState(false);
Expand Down Expand Up @@ -391,6 +391,7 @@ export async function getStaticProps({ locale, params }: any) {
data: res,
team: params.team,
},
revalidate: 60 * 60, // Every hour
};
}
export async function getStaticPaths() {
Expand Down
12 changes: 6 additions & 6 deletions src/pages/teams/[team]/manage/members.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,17 @@ import {
import { useEffect, useState } from 'react';
import useSWR, { mutate } from 'swr';

import { modals } from '@mantine/modals';
import { showNotification } from '@mantine/notifications';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { useRouter } from 'next/router';
import thumbnail from '../../../../../public/images/thumbnails/teams.png';
import Page from '../../../../components/Page';
import SearchInput from '../../../../components/SearchInput';
import SettingsTabs from '../../../../components/SettingsTabs';
import { UsersTable } from '../../../../components/UsersTable';
import fetcher from '../../../../utils/Fetcher';
import { modals } from '@mantine/modals';
import { serverSideTranslations } from 'next-i18next/serverSideTranslations';
import { showNotification } from '@mantine/notifications';
import thumbnail from '../../../../../public/images/thumbnails/teams.png';
import { useRouter } from 'next/router';
import { useUser } from '../../../../hooks/useUser';
import fetcher from '../../../../utils/Fetcher';

const Settings = () => {
const user = useUser();
Expand Down
1 change: 1 addition & 0 deletions src/pages/teams/[team]/manage/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ export async function getStaticProps({ locale, params }: any) {
...(await serverSideTranslations(locale, ['common', 'teams'])),
data: res,
},
revalidate: 60 * 60, // Every hour
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/teams/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,6 @@ export async function getStaticProps({ locale }: any) {

return {
props: { data: res, ...(await serverSideTranslations(locale, ['common', 'teams'])) },
revalidate: 60 * 60, // Every hour
revalidate: 60 * 20, // Every 20 minutes
};
}

0 comments on commit 4a4f6f2

Please sign in to comment.