[fix] hydration bug in iframe (#813)
* Fixes hydration bug in iframe * Update [id].tsx
This commit is contained in:
parent
e6d3074f90
commit
0ac0df036b
4 changed files with 18 additions and 5 deletions
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { styled } from 'styles'
|
import { styled } from 'styles'
|
||||||
|
|
||||||
export function IFrameWarning({ url = 'https://tldraw.com' }: { url?: string }) {
|
export default function IFrameWarning({ url = 'https://tldraw.com' }: { url?: string }) {
|
||||||
const [copied, setCopied] = React.useState(false)
|
const [copied, setCopied] = React.useState(false)
|
||||||
const rTimeout = React.useRef<any>(0)
|
const rTimeout = React.useRef<any>(0)
|
||||||
|
|
||||||
|
@ -93,6 +93,8 @@ const StyledContainer = styled('div', {
|
||||||
fontSize: '$3',
|
fontSize: '$3',
|
||||||
gap: '$5',
|
gap: '$5',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
|
border: '1px solid $hover',
|
||||||
|
borderRadius: '$2',
|
||||||
})
|
})
|
||||||
|
|
||||||
const StyledUrlLink = styled('a', {
|
const StyledUrlLink = styled('a', {
|
||||||
|
|
|
@ -2,7 +2,11 @@ import * as React from 'react'
|
||||||
import type { GetServerSideProps } from 'next'
|
import type { GetServerSideProps } from 'next'
|
||||||
import { getSession } from 'next-auth/react'
|
import { getSession } from 'next-auth/react'
|
||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
import { IFrameWarning } from 'components/IFrameWarning'
|
|
||||||
|
const IFrameWarning = dynamic(() => import('components/IFrameWarning'), {
|
||||||
|
ssr: false,
|
||||||
|
}) as any
|
||||||
|
|
||||||
const MultiplayerEditor = dynamic(() => import('components/MultiplayerEditor'), {
|
const MultiplayerEditor = dynamic(() => import('components/MultiplayerEditor'), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
}) as any
|
}) as any
|
||||||
|
|
|
@ -3,7 +3,11 @@ import type { GetServerSideProps } from 'next'
|
||||||
import { getSession } from 'next-auth/react'
|
import { getSession } from 'next-auth/react'
|
||||||
import dynamic from 'next/dynamic'
|
import dynamic from 'next/dynamic'
|
||||||
import { Utils } from '@tldraw/core'
|
import { Utils } from '@tldraw/core'
|
||||||
import { IFrameWarning } from 'components/IFrameWarning'
|
|
||||||
|
const IFrameWarning = dynamic(() => import('components/IFrameWarning'), {
|
||||||
|
ssr: false,
|
||||||
|
}) as any
|
||||||
|
|
||||||
const ReadOnlyMultiplayerEditor = dynamic(() => import('components/ReadOnlyMultiplayerEditor'), {
|
const ReadOnlyMultiplayerEditor = dynamic(() => import('components/ReadOnlyMultiplayerEditor'), {
|
||||||
ssr: false,
|
ssr: false,
|
||||||
}) as any
|
}) as any
|
||||||
|
|
|
@ -2,8 +2,11 @@ import * as React from 'react'
|
||||||
|
|
||||||
export default function IFrame() {
|
export default function IFrame() {
|
||||||
return (
|
return (
|
||||||
<div className="tldraw">
|
<div className="tldraw" style={{ padding: 32 }}>
|
||||||
<iframe src="http://localhost:3000/r/hello" style={{ width: '100%', height: '50%' }} />
|
<iframe
|
||||||
|
src="http://localhost:3000/r/hello"
|
||||||
|
style={{ width: '100%', height: '50%', border: 'none' }}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue