Skip to content

Commit e9fda79

Browse files
committed
fix: mapping property in comments
1 parent 5f8dd94 commit e9fda79

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

components/comments/Giscus.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useTheme } from 'next-themes'
33

44
import siteMetadata from '@/data/siteMetadata'
55

6-
const Giscus = ({ mapping }) => {
6+
const Giscus = () => {
77
const [enableLoadComments, setEnabledLoadComments] = useState(true)
88
const { theme, resolvedTheme } = useTheme()
99
const commentsTheme =
@@ -18,8 +18,17 @@ const Giscus = ({ mapping }) => {
1818
const LoadComments = useCallback(() => {
1919
setEnabledLoadComments(false)
2020

21-
const { repo, repositoryId, category, categoryId, reactions, metadata, inputPosition, lang } =
22-
siteMetadata?.comment?.giscusConfig
21+
const {
22+
repo,
23+
repositoryId,
24+
category,
25+
categoryId,
26+
mapping,
27+
reactions,
28+
metadata,
29+
inputPosition,
30+
lang,
31+
} = siteMetadata?.comment?.giscusConfig
2332

2433
const script = document.createElement('script')
2534
script.src = 'https://giscus.app/client.js'
@@ -43,7 +52,7 @@ const Giscus = ({ mapping }) => {
4352
const comments = document.getElementById(COMMENTS_ID)
4453
if (comments) comments.innerHTML = ''
4554
}
46-
}, [commentsTheme, mapping])
55+
}, [commentsTheme])
4756

4857
// Reload on theme change
4958
useEffect(() => {

components/comments/Utterances.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useTheme } from 'next-themes'
33

44
import siteMetadata from '@/data/siteMetadata'
55

6-
const Utterances = ({ issueTerm }) => {
6+
const Utterances = () => {
77
const [enableLoadComments, setEnabledLoadComments] = useState(true)
88
const { theme, resolvedTheme } = useTheme()
99
const commentsTheme =
@@ -18,7 +18,7 @@ const Utterances = ({ issueTerm }) => {
1818
const script = document.createElement('script')
1919
script.src = 'https://utteranc.es/client.js'
2020
script.setAttribute('repo', siteMetadata.comment.utterancesConfig.repo)
21-
script.setAttribute('issue-term', issueTerm)
21+
script.setAttribute('issue-term', siteMetadata.comment.utterancesConfig.issueTerm)
2222
script.setAttribute('label', siteMetadata.comment.utterancesConfig.label)
2323
script.setAttribute('theme', commentsTheme)
2424
script.setAttribute('crossorigin', 'anonymous')
@@ -31,7 +31,7 @@ const Utterances = ({ issueTerm }) => {
3131
const comments = document.getElementById(COMMENTS_ID)
3232
if (comments) comments.innerHTML = ''
3333
}
34-
}, [commentsTheme, issueTerm])
34+
}, [commentsTheme])
3535

3636
// Reload on theme change
3737
useEffect(() => {

components/comments/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ const Comments = ({ frontMatter }) => {
4040
}
4141
return (
4242
<div id="comment">
43-
{siteMetadata.comment && siteMetadata.comment.provider === 'giscus' && (
44-
<GiscusComponent mapping={term} />
45-
)}
43+
{siteMetadata.comment && siteMetadata.comment.provider === 'giscus' && <GiscusComponent />}
4644
{siteMetadata.comment && siteMetadata.comment.provider === 'utterances' && (
47-
<UtterancesComponent issueTerm={term} />
45+
<UtterancesComponent />
4846
)}
4947
{siteMetadata.comment && siteMetadata.comment.provider === 'disqus' && (
5048
<DisqusComponent frontMatter={frontMatter} />

0 commit comments

Comments
 (0)