Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

there is a warning at the start of rendering "Prop id did not match" #212

Open
aseph8083 opened this issue Oct 17, 2022 · 1 comment
Open

Comments

@aseph8083
Copy link

I'm using next js with typescript, when I start rendering a message appears

image

@SmileHub
Copy link

SmileHub commented Oct 22, 2024

confirming, having the same warning when using with next.js:

Warning: Prop `id` did not match. Server: "react-svg-pan-zoom_miniature_mask_uid1" Client: "react-svg-pan-zoom_miniature_mask_uid2" Error Component Stack
    at mask (<anonymous>)
    at defs (<anonymous>)
    at g (<anonymous>)
    at MiniatureMask (miniature-mask.js:13:5)
    at RandomUID (RandomUID.js:16:7)
    at g (<anonymous>)
    at g (<anonymous>)
    at svg (<anonymous>)
    at div (<anonymous>)
    at Miniature (miniature.js:22:5)
    at div (<anonymous>)
    at ReactSVGPanZoom (viewer.js:57:14)
    at UncontrolledReactSVGPanZoom (uncontrolled-viewer.js:21:5)

a temporary work around on next.js is to avoid using SSR on this component till it's fixed.
Since i'm having it wrapped with ReactSvgPanZoomLoader, so i'm just setting it up without SSR

import dynamic from 'next/dynamic';
const ReactSvgPanZoomLoader = dynamic(() => import('react-svg-pan-zoom-loader').then(mod => mod.ReactSvgPanZoomLoader), { ssr: false });

my code:

	<ReactSvgPanZoomLoader src="/map.svg" render={(content) => (
				<UncontrolledReactSVGPanZoom
					ref={Viewer}
					width={500}
					height={500}
					onZoom={e => console.log('zoom')}
					onPan={e => console.log('pan')}
					onClick={event => console.log('click', event.x, event.y, event.originalEvent)}
					toolbarProps={toolbarProps}
					miniatureProps={miniatureProps}
				>
					<svg width={500} height={500}>
						{content}
					</svg>
				</UncontrolledReactSVGPanZoom>
		)} />
	</div>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants