Skip to content

Commit

Permalink
markdown block - guard slice
Browse files Browse the repository at this point in the history
  • Loading branch information
Wattenberger committed May 4, 2022
1 parent b57d59b commit 0eba103
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/blocks/file-blocks/live-markdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const issueStateToStatusMap = {
};
function Issues({ num = 3 }) {
const { issues = [] } = useContext(MarkdownContext);
const filteredIssues = issues?.slice(0, num) || [];
const filteredIssues = issues?.slice?.(0, num) || [];

if (!filteredIssues.length) {
return (
Expand Down Expand Up @@ -178,7 +178,7 @@ function Issues({ num = 3 }) {
}
function Releases({ num = 3 }) {
const { releases = [] } = useContext(MarkdownContext);
const filteredReleases = releases?.slice(0, num) || [];
const filteredReleases = releases?.slice?.(0, num) || [];

if (!filteredReleases.length) {
return (
Expand Down Expand Up @@ -219,7 +219,7 @@ function Releases({ num = 3 }) {
}
function Commits({ num = 2 }) {
const { commits = [] } = useContext(MarkdownContext);
const filteredCommits = commits?.slice(0, num) || [];
const filteredCommits = commits?.slice?.(0, num) || [];

if (!filteredCommits.length) {
return (
Expand Down

0 comments on commit 0eba103

Please sign in to comment.