fix: 修复errorBoundary (#504)

<!-- Note -->
<!-- This is a template for submitting a new feature.
Use the bug fix template if you're submitting a bug fix pull request by adding `template=bug_fix.md` to your pull request URL. -->

# Description
<!-- Describe the new feature or modification to an existing feature clearly and consciously. -->

# Motivation
<!-- Explain the reason for adding or modifying this feature. -->

# Key changes
<!-- Provide a technically detailed description of the key changes made. -->
- Frontend
- Backend

# Test plan
## Suggestions
<!-- Provide any suggestions or recommendations for improvements in the testing plan. -->

## Underlying risk
<!-- Identify any potential risks or issues that may arise from the new feature or modification. -->

# Showcase
<!-- Including any screenshots of the new feature or modification. -->

Reviewed-on: daoyoucloud/tachycode#504
Co-authored-by: bai.jingfeng <bai.jingfeng@foxmail.com>
Co-committed-by: bai.jingfeng <bai.jingfeng@foxmail.com>
This commit is contained in:
bai.jingfeng 2024-03-26 21:50:03 +08:00 committed by baijingfeng
parent f2ad0534fa
commit 6251551ded

View File

@ -1,7 +1,7 @@
import React, { useState, useEffect } from 'react';
import { useTranslation } from '../../locale';
export const ErrorBoundary = ({ children, fallback }) => {
export const ErrorBoundary = ({ children, fallback = null }) => {
const { t } = useTranslation();
const [hasError, setHasError] = useState(false);