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

SplitviewReact rendered twice in React Strict mode #866

Open
Morcatko opened this issue Mar 6, 2025 · 0 comments
Open

SplitviewReact rendered twice in React Strict mode #866

Morcatko opened this issue Mar 6, 2025 · 0 comments

Comments

@Morcatko
Copy link

Morcatko commented Mar 6, 2025

Describe the bug
SplitviewReact component is placed twice into a DOM when React StrictMode is enabled. (It works fine with non-strict mode)

To Reproduce
This is a code I have in my next.js (App Router page)

const components = {
	"panels-container": () => <div >pc</div>
};

const PageContent = () => {
	const [api, setApi] = useState<SplitviewApi>()
	const onReady = (event: SplitviewReadyEvent) => setApi(event.api);

	useEffect(() => {
		if (!api) return;
		api.addPanel({
			id: 'panels-container',
			component: 'panels-container'
		});
	}, [api]);

	console.log("PageContent");

	return <SplitviewReact
		orientation={Orientation.HORIZONTAL}
		components={components}
		onReady={onReady}
		className={`XXXXX dockview-theme-light`}
	/>
}

SplitView is correctly rendered as a 100% height component with a "pc" content however above it is an empty container with 100% height (see screenshot)
I use DockView in the same app and it works well.
If that code is not enough I will make some minimal next.js app to reproduce

Expected behavior
"dummy" instance is not created

Screenshots

Image

Desktop (please complete the following information):
Dockview 3.2.0

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

1 participant