Skip to content

Commit 554712c

Browse files
committed
move contributors shuffle outside of the component to avoid hydration issues
1 parent 89953b5 commit 554712c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/components/Contributors.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useEffect, useState } from "react"
12
import shuffle from "lodash/shuffle"
23
import { Box, Flex, Image, LinkBox, LinkOverlay } from "@chakra-ui/react"
34

@@ -14,8 +15,14 @@ export interface Contributor {
1415
contributions: Array<string>
1516
}
1617

18+
const allContributors = JSON.parse(data)
19+
1720
const Contributors = () => {
18-
const contributorsList = shuffle(JSON.parse(data).contributors)
21+
const [contributorsList, setContributorsList] = useState<Contributor[]>([])
22+
23+
useEffect(() => {
24+
setContributorsList(shuffle(allContributors.contributors))
25+
}, [])
1926

2027
return (
2128
<>

0 commit comments

Comments
 (0)