May not be able to use child trick to prevent excess navbar space usage, log a debug warning.

This commit is contained in:
Roland 2025-01-11 11:06:31 -07:00
parent af5d4dfd51
commit dd35cf591f
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680

View file

@ -61,7 +61,12 @@ function MenuLink({link}) {
function NavIconWrapper({children}) {
// Do not add margins around empty react element to avoid filling up navbar.
const emptyChild = !children || isReactChildNull(children);
let emptyChild = false;
try {
emptyChild = !children || isReactChildNull(children);
} catch (e) {
console.debug('Failed to get children of react element');
}
const style = emptyChild ? {} : {marginTop: '0.8em', marginLeft: '1.5em'};
return <div style={style}>{children}</div>
}