Skip to content

Commit

Permalink
perf: use static site generation
Browse files Browse the repository at this point in the history
  • Loading branch information
skinmaker1345 committed Oct 12, 2024
1 parent 816084a commit b7b8b55
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pages/bots/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ const Index: NextPage<IndexProps> = ({ votes, newBots, trusted }) => {
)
}

export const getServerSideProps = async () => {
export const getStaticProps = async () => {
const votes = await Query.get.list.votes.load(1)
const newBots = await Query.get.list.new.load(1)
const trusted = await Query.get.list.trusted.load(1)

return { props: { votes, newBots, trusted } }
return { props: { votes, newBots, trusted }, revalidate: 60 }
}

interface IndexProps {
Expand Down
4 changes: 2 additions & 2 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ const Index: NextPage<IndexProps> = ({ bots, servers }) => {
)
}

export const getServerSideProps = async () => {
export const getStaticProps = async () => {
const bots = await Query.get.list.votes.load(1)
const servers = await Query.get.serverList.votes.load(1)

return { props: { bots, servers } }
return { props: { bots, servers }, revalidate: 60 }
}

interface IndexProps {
Expand Down
5 changes: 3 additions & 2 deletions pages/security.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GetServerSideProps, NextPage } from 'next'
import { GetServerSideProps, GetStaticProps, NextPage } from 'next'
import dynamic from 'next/dynamic'

import { User } from '@types'
Expand Down Expand Up @@ -87,11 +87,12 @@ const Security: NextPage<SecurityProps> = ({ bugReports }) => {
)
}

export const getServerSideProps: GetServerSideProps<SecurityProps> = async () => {
export const getStaticProps: GetStaticProps<SecurityProps> = async () => {
return {
props: {
bugReports: await Promise.all(BUG_REPORTERS.map((u) => get.user.load(u))),
},
revalidate: 60,
}
}

Expand Down
4 changes: 2 additions & 2 deletions pages/servers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ const ServerIndex: NextPage<ServerIndexProps> = ({ votes, trusted }) => {
)
}

export const getServerSideProps = async () => {
export const getStaticProps = async () => {
const votes = await Query.get.serverList.votes.load(1)
const trusted = await Query.get.serverList.trusted.load(1)

return { props: { votes, trusted } }
return { props: { votes, trusted }, revalidate: 60 }
}

interface ServerIndexProps {
Expand Down

0 comments on commit b7b8b55

Please sign in to comment.