Skip to content

Commit

Permalink
[FIX] handle null document titles
Browse files Browse the repository at this point in the history
  • Loading branch information
MaciejWas committed Nov 28, 2024
1 parent ac681f3 commit 1062a86
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Topbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import { MystState } from "../mystState";
import { useComputed } from "@preact/signals";

const renderMdLinks = (title) =>
[...title.matchAll(/\[(.+)\]\(([^\s]+)\)/g)].reduce((prev, match) => prev.replace(match[0], `<a href="${match[2]}">${match[1]}</a>`), title);
[...(title || "").matchAll(/\[(.+)\]\(([^\s]+)\)/g)].reduce(
(prev, match) => prev.replace(match[0], `<a href="${match[2]}">${match[1]}</a>`),
title,
);

const Topbar = styled.div`
z-index: 10;
Expand Down

0 comments on commit 1062a86

Please sign in to comment.