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({ ...@@ -82,9 +82,12 @@ function GroupListItem({
onExpand(!isExpanded); onExpand(!isExpanded);
}; };
const copyLink = () => { /**
* @param {string} url
*/
const copyLink = url => {
try { try {
copyText(activityUrl); copyText(url);
toastMessenger.success(`Copied link for "${group.name}"`); toastMessenger.success(`Copied link for "${group.name}"`);
} catch (err) { } catch (err) {
toastMessenger.error('Unable to copy link'); toastMessenger.error('Unable to copy link');
...@@ -121,7 +124,7 @@ function GroupListItem({ ...@@ -121,7 +124,7 @@ function GroupListItem({
{activityUrl && ( {activityUrl && (
<li> <li>
<MenuItem <MenuItem
onClick={copyLink} onClick={() => copyLink(activityUrl)}
icon="copy" icon="copy"
isSubmenuItem={true} isSubmenuItem={true}
label={copyLinkLabel} label={copyLinkLabel}
......
...@@ -91,7 +91,7 @@ export default function MenuItem({ ...@@ -91,7 +91,7 @@ export default function MenuItem({
let focusTimer = null; let focusTimer = null;
let renderedIcon = null; let renderedIcon = null;
if (icon !== 'blank') { if (icon && icon !== 'blank') {
renderedIcon = iconIsUrl ? ( renderedIcon = iconIsUrl ? (
<img className={iconClass} alt={iconAlt} src={icon} /> <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