Skip to content

Commit fc8cbad

Browse files
committed
fix: error
1 parent a5586ea commit fc8cbad

File tree

6 files changed

+23
-19
lines changed

6 files changed

+23
-19
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
node-version: '14'
1919
- run: yarn
20-
- run: yarn posts --token=${{ secrets.GG_TOKEN }} --owner=${{ secrets.GG_USER }} --repo=${{ secrets.GG_REPO }}
20+
- run: yarn posts --token=${{ secrets.GG_TOKEN }} --owner=${{ secrets.GG_USER }} --repo=${{ secrets.GG_REPO }} ---issues-owner=${{ secrets.GG_ISSUES_USER }} --repo=${{ secrets.GG_ISSUES_REPO }} --type=${{ secrets.GG_TYPE }}
2121
- run: yarn reconf
2222
- run: yarn build
2323
- run: yarn copy

gatsby-node.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ exports.createSchemaCustomization = ({ actions }) => {
148148
edges: [LabelsEdge]
149149
}
150150
type LabelsEdge {
151-
node: Labels!
151+
node: Labels
152152
}
153153
type Labels {
154154
id: String
@@ -158,8 +158,10 @@ exports.createSchemaCustomization = ({ actions }) => {
158158
159159
type IssuesJson implements Node {
160160
labels: LabelsConnection
161-
author: Author!
161+
author: Author
162162
comments: CommentsConnection
163+
category: Category
164+
upvoteCount: Int
163165
}
164166
165167
type CommentsConnection {
@@ -179,7 +181,7 @@ exports.createSchemaCustomization = ({ actions }) => {
179181
edges: [RepliesEdge]
180182
}
181183
type RepliesEdge {
182-
node: Replies!
184+
node: Replies
183185
}
184186
type Replies {
185187
id: String!

src/hooks/useSite.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default function useSite() {
1111
owner
1212
description
1313
userLogo
14+
type
1415
}
1516
}
1617
}

src/templates/category.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default function BlogCategory(props: any) {
3131
}
3232

3333
export const query = graphql`
34-
query DevCategoryQuery($name: String!) {
34+
query GGCategoryQuery($name: String!) {
3535
allDiscussionsJson(
3636
filter: { node: { category: { name: { eq: $name } } } }
3737
) {

src/templates/issues.tsx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ import '@styles/issues.scss';
1717
export default function BlogIssues(props: any) {
1818
const { repo } = useSite();
1919
const [isHide, setHide] = useState(true);
20-
const data = props.data.issuesJson;
21-
const labels = data.labels.edges;
22-
const comments = data.comments.edges;
23-
const hasComments = comments.length > 0;
24-
const isa = data.category.isAnswerable;
25-
const author = data.author;
20+
const data = props?.data?.issuesJson || {};
21+
const labels = data.labels?.edges;
22+
const comments = data.comments?.edges;
23+
const hasComments = comments?.length > 0;
24+
const isa = data?.category?.isAnswerable;
25+
const author = data?.author || {};
2626
const pageCxt = props.pageContext;
2727

2828
useEffect(() => {
29-
setHide(data.category.isAnswerable);
29+
setHide(data.category?.isAnswerable);
3030
}, []);
3131

3232
return (
@@ -39,13 +39,14 @@ export default function BlogIssues(props: any) {
3939
</span>
4040
</h1>
4141
<div className="widget">
42-
<Category data={data.category} />
43-
{labels.map(({ node }: any) => {
44-
return <Label key={node.name} data={node} />;
45-
})}
42+
<Category data={data?.category} />
43+
{labels &&
44+
labels.map(({ node }: any) => {
45+
return <Label key={node.name} data={node} />;
46+
})}
4647
</div>
4748
<div>
48-
<Author author={author} date={data.updatedAt} />
49+
<Author author={author} date={data?.updatedAt} />
4950
<div className="ques-content">
5051
{isa && (
5152
<div>
@@ -110,7 +111,7 @@ export default function BlogIssues(props: any) {
110111
}
111112

112113
export const query = graphql`
113-
query DevIssuesQuery($number: Int!) {
114+
query GGIssuesQuery($number: Int!) {
114115
issuesJson(number: { eq: $number }) {
115116
id
116117
title

src/templates/labels.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export default function BlogCategory(props: any) {
3333
}
3434

3535
export const query = graphql`
36-
query DevLabelsQuery($name: String!) {
36+
query GGLabelsQuery($name: String!) {
3737
allDiscussionsJson(
3838
filter: {
3939
node: {

0 commit comments

Comments
 (0)