refactor: Replace direct `process.env.NODE_ENV === 'development'` checks with `IS_DEV` constant.

This commit is contained in:
yyh 2025-12-28 22:24:56 +08:00
parent 7c8b58167f
commit e323d583b3
No known key found for this signature in database
2 changed files with 4 additions and 3 deletions

View File

@ -3,14 +3,14 @@
import * as Sentry from '@sentry/react' import * as Sentry from '@sentry/react'
import { useEffect } from 'react' import { useEffect } from 'react'
const isDevelopment = process.env.NODE_ENV === 'development' import { IS_DEV } from '@/config'
const SentryInitializer = ({ const SentryInitializer = ({
children, children,
}: { children: React.ReactElement }) => { }: { children: React.ReactElement }) => {
useEffect(() => { useEffect(() => {
const SENTRY_DSN = document?.body?.getAttribute('data-public-sentry-dsn') const SENTRY_DSN = document?.body?.getAttribute('data-public-sentry-dsn')
if (!isDevelopment && SENTRY_DSN) { if (!IS_DEV && SENTRY_DSN) {
Sentry.init({ Sentry.init({
dsn: SENTRY_DSN, dsn: SENTRY_DSN,
integrations: [ integrations: [

View File

@ -35,6 +35,7 @@ import ReactFlow, {
useReactFlow, useReactFlow,
useStoreApi, useStoreApi,
} from 'reactflow' } from 'reactflow'
import { IS_DEV } from '@/config'
import { useEventEmitterContextContext } from '@/context/event-emitter' import { useEventEmitterContextContext } from '@/context/event-emitter'
import { import {
useAllBuiltInTools, useAllBuiltInTools,
@ -361,7 +362,7 @@ export const Workflow: FC<WorkflowProps> = memo(({
} }
}, [schemaTypeDefinitions, fetchInspectVars, isLoadedVars, vars, customTools, buildInTools, workflowTools, mcpTools, dataSourceList]) }, [schemaTypeDefinitions, fetchInspectVars, isLoadedVars, vars, customTools, buildInTools, workflowTools, mcpTools, dataSourceList])
if (process.env.NODE_ENV === 'development') { if (IS_DEV) {
store.getState().onError = (code, message) => { store.getState().onError = (code, message) => {
if (code === '002') if (code === '002')
return return