Skip to content

Commit 860f439

Browse files
Allicolyerkelseyyim
authored andcommitted
fix deleted tutorial bug
1 parent dd16167 commit 860f439

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

packages/gatsby-theme/src/pages/profile.tsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,25 @@ const ProfilePage: React.FunctionComponent<ProfileProps> = ({ user }) => {
6969
<button onClick={() => logoutUser()}> Log out </button>
7070
<Heading> Upvoted Tutorials </Heading>
7171
<ul>
72-
{user.upvoted.map(a => (
73-
<li key={a.tutorial.id}>
74-
<span>{a.tutorial.name}</span>
75-
</li>
76-
))}
72+
{user.upvoted.map(
73+
a =>
74+
a.tutorial && (
75+
<li key={a.tutorial.id}>
76+
<span>{a.tutorial.name}</span>
77+
</li>
78+
),
79+
)}
7780
</ul>
7881
<Heading> Saved Tutorials </Heading>
7982
<ul>
80-
{user.saved.map(a => (
81-
<li key={a.tutorial.id}>
82-
<span>{a.tutorial.name}</span>
83-
</li>
84-
))}
83+
{user.saved.map(
84+
a =>
85+
a.tutorial && (
86+
<li key={a.tutorial.id}>
87+
<span>{a.tutorial.name}</span>
88+
</li>
89+
),
90+
)}
8591
</ul>
8692
</Layout>
8793
);

0 commit comments

Comments
 (0)