Commit b737e07b authored by Robert Knight's avatar Robert Knight

Fix a couple of possibly-null errors from TS

Add checks or tweak the code to make it obvious to TS that a value is
not-null.
parent b984fba2
......@@ -82,9 +82,12 @@ function GroupListItem({
onExpand(!isExpanded);
};
const copyLink = () => {
/**
* @param {string} url
*/
const copyLink = url => {
try {
copyText(activityUrl);
copyText(url);
toastMessenger.success(`Copied link for "${group.name}"`);
} catch (err) {
toastMessenger.error('Unable to copy link');
......@@ -121,7 +124,7 @@ function GroupListItem({
{activityUrl && (
<li>
<MenuItem
onClick={copyLink}
onClick={() => copyLink(activityUrl)}
icon="copy"
isSubmenuItem={true}
label={copyLinkLabel}
......
......@@ -91,7 +91,7 @@ export default function MenuItem({
let focusTimer = null;
let renderedIcon = null;
if (icon !== 'blank') {
if (icon && icon !== 'blank') {
renderedIcon = iconIsUrl ? (
<img className={iconClass} alt={iconAlt} src={icon} />
) : (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment