Skip to content

Commit

Permalink
Fix/Minified React error
Browse files Browse the repository at this point in the history
  • Loading branch information
ishiko732 committed Aug 10, 2024
1 parent ec3eab9 commit d222bb7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
10 changes: 9 additions & 1 deletion src/components/train/own-train-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ import { computerMinuteOffset, get_timezones } from '@/lib/date';
import { useEffect, useRef } from 'react';
import { Button } from '../ui/button';
import { UseFormReturn } from 'react-hook-form';
import dynamic from 'next/dynamic';

const NoSSR = dynamic(() => Promise.resolve(OwnTrain), {
ssr: false,
});

export default NoSSR;

const timezones = get_timezones();
export default function OwnTrain({
function OwnTrain({
form,
}: {
form: UseFormReturn<
Expand Down Expand Up @@ -112,6 +119,7 @@ export default function OwnTrain({
disabled={loading}
onClick={handleClick}
title='Training using your own revlog.'
suppressHydrationWarning
>
Train(by own Revlog)
</Button>
Expand Down
11 changes: 9 additions & 2 deletions src/components/train/train-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@ import FileTrain from './file-train-button';
import { useForm } from 'react-hook-form';
import { useTrainContext } from '@/context/TrainContext';
import OwnTrain from './own-train-button';
import dynamic from 'next/dynamic';

export default function FSRSParamTrainForm({
const NoSSR = dynamic(() => Promise.resolve(FSRSParamTrainForm), {
ssr: false,
});

export default NoSSR;

function FSRSParamTrainForm({
children,
}: {
children?: React.ReactNode;
Expand All @@ -30,7 +37,7 @@ export default function FSRSParamTrainForm({
});
return (
<Form {...form}>
<form className='space-y-4 w-1/2 flex justify-center flex-col flex-1'>
<form className='space-y-4 w-1/2 flex justify-center flex-col flex-1' suppressHydrationWarning>
<FormField
control={form.control}
name='timezone'
Expand Down

1 comment on commit d222bb7

@vercel
Copy link

@vercel vercel bot commented on d222bb7 Aug 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.