Use helpers to check environment in frontend (#27633)
This commit is contained in:
parent
7ef56d6e50
commit
277e6968f5
8 changed files with 28 additions and 9 deletions
|
@ -2,6 +2,8 @@ import classNames from 'classnames';
|
|||
|
||||
import { ReactComponent as CheckBoxOutlineBlankIcon } from '@material-symbols/svg-600/outlined/check_box_outline_blank.svg';
|
||||
|
||||
import { isProduction } from 'mastodon/utils/environment';
|
||||
|
||||
interface SVGPropsWithTitle extends React.SVGProps<SVGSVGElement> {
|
||||
title?: string;
|
||||
}
|
||||
|
@ -24,7 +26,7 @@ export const Icon: React.FC<Props> = ({
|
|||
}) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (!IconComponent) {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (!isProduction()) {
|
||||
throw new Error(
|
||||
`<Icon id="${id}" className="${className}"> is missing an "icon" prop.`,
|
||||
);
|
||||
|
|
|
@ -11,6 +11,7 @@ import type {
|
|||
import { createBrowserHistory } from 'history';
|
||||
|
||||
import { layoutFromWindow } from 'mastodon/is_mobile';
|
||||
import { isDevelopment } from 'mastodon/utils/environment';
|
||||
|
||||
interface MastodonLocationState {
|
||||
fromMastodon?: boolean;
|
||||
|
@ -40,7 +41,7 @@ function normalizePath(
|
|||
} else if (
|
||||
location.state !== undefined &&
|
||||
state !== undefined &&
|
||||
process.env.NODE_ENV === 'development'
|
||||
isDevelopment()
|
||||
) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue