react-nodegui icon indicating copy to clipboard operation
react-nodegui copied to clipboard

Modifying WindowFlags causes Window to close

Open jabza opened this issue 4 years ago • 0 comments

Describe the bug I am trying to toggle the WindowType.FramelessWindowHint windowFlag, but this causes the window to close.

This happens when changing the windowFlags props of Window or calling setWindowFlag via a ref.

export default function MainWindow() {
	const dispatch = useDispatch();
	const toggle = useSelector(s => s.settings.toggle);

	const flags = {
		[WindowType.FramelessWindowHint]: toggle
	}

	const minSize = {
		width: 256,
		height: 128
	}

	return (
		<Window windowIcon={winIcon} windowTitle={pkg.name} windowFlags={flags} minSize={minSize}>
			<Button on={{clicked: () => dispatch(settings.actions.toggle())}}>click me!</Button>
		</Window>
	);
}

This happens both in development and production builds.

Expected behavior WindowFlags are updated when the props change.

Modifying the icon and title via props works as expected. windowsFlags changes causes in the window closing.

It appears any WindowFlag change results in the same behaviour...

Any ideas?

jabza avatar Jul 29 '20 21:07 jabza