Skip to content

Commit

Permalink
Change dynamic import of captcha invisible to regular import
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Nov 30, 2023
1 parent ebe7d19 commit 0efbf43
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 25 deletions.
9 changes: 1 addition & 8 deletions src/components/auth/LoginModal/LoginModal.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import CaptchaInvisible from '@/components/captcha/CaptchaInvisible'
import InfoPanel from '@/components/InfoPanel'
import Modal, { ModalFunctionalityProps } from '@/components/modals/Modal'
import { useMyAccount, useMyMainAddress } from '@/stores/my-account'
import { cx } from '@/utils/class-names'
import { isTouchDevice } from '@/utils/device'
import dynamic from 'next/dynamic'
import { useEffect, useRef, useState } from 'react'
import { loginModalContents, LoginModalStep } from './LoginModalContent'

const CaptchaInvisible = dynamic(
() => import('@/components/captcha/CaptchaInvisible'),
{
ssr: false,
}
)

export type LoginModalProps = ModalFunctionalityProps & {
initialOpenState?: LoginModalStep
onBackClick?: () => void
Expand Down
10 changes: 7 additions & 3 deletions src/components/captcha/CaptchaInvisible.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ export type CaptchaInvisibleProps = {
export default function CaptchaInvisible({ children }: CaptchaInvisibleProps) {
const { runCaptcha } = useCaptchaContext()

return children(runCaptcha, (className) => (
<CaptchaTermsAndService className={className} />
))
return (
<>
{children(runCaptcha, (className) => (
<CaptchaTermsAndService className={className} />
))}
</>
)
}
7 changes: 1 addition & 6 deletions src/components/chats/ChatForm.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Send from '@/assets/icons/send.svg'
import Button, { ButtonProps } from '@/components/Button'
import CaptchaInvisible from '@/components/captcha/CaptchaInvisible'
import TextArea, { TextAreaProps } from '@/components/inputs/TextArea'
import EmailSubscribeModal from '@/components/modals/EmailSubscribeModal'
import { ERRORS } from '@/constants/error'
Expand Down Expand Up @@ -42,12 +43,6 @@ import { interceptPastedData } from '../extensions/config'
const StayUpdatedModal = dynamic(() => import('./StayUpdatedModal'), {
ssr: false,
})
const CaptchaInvisible = dynamic(
() => import('@/components/captcha/CaptchaInvisible'),
{
ssr: false,
}
)

export type ChatFormProps = Omit<ComponentProps<'form'>, 'onSubmit'> & {
hubId: string
Expand Down
9 changes: 1 addition & 8 deletions src/services/subsocial/utils/mutation.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import CaptchaInvisible from '@/components/captcha/CaptchaInvisible'
import useToastError from '@/hooks/useToastError'
import { SubsocialMutationConfig } from '@/subsocial-query/subsocial/types'
import { UseMutationResult } from '@tanstack/react-query'
import dynamic from 'next/dynamic'
import { useState } from 'react'
import useCommonTxSteps from '../hooks'

const CaptchaInvisible = dynamic(
() => import('@/components/captcha/CaptchaInvisible'),
{
ssr: false,
}
)

type Status =
| 'idle'
| 'starting'
Expand Down

0 comments on commit 0efbf43

Please sign in to comment.