preact-redux icon indicating copy to clipboard operation
preact-redux copied to clipboard

Preact X, preact-redux is not working..

Open ohute-couture opened this issue 6 years ago • 6 comments

Preact, 10.0.0-alpha.2 preact-redux is not working, react-redux work properly image There is No Error, Just There is <Provider/> without children(<App/>) Check Plz

ohute-couture avatar Mar 22 '19 10:03 ohute-couture

Can confirm this is also occurring with our app, but not sure how to replicate it at the moment.

Sexual avatar Mar 23 '19 13:03 Sexual

The problem seems to be that in Preact X, props.children is no longer guaranteed to be an array, and in this case, if you're passsing a single child, props.children is a VNode.

There's this in src/compat.js:

export const Children = {
	only(children) {
		return children && children[0] || null;
	}
};

Here children[0] doesn't exist. Should be something like

export const Children = {
	only(children) {
		if (Array.isArray(children))
			return children[0]
		else if (children && typeof children === "object")
			return children
		else
			return null
	}
};

ohmoses avatar Apr 02 '19 06:04 ohmoses

For those working with X, try using react-redux and preact/compat. Hopefully this will be fixed soon.

developit avatar Apr 11 '19 03:04 developit

Hey!

Could you guys test preact-redux's master?

I suspect that my PR, #41, fixes the problems related to Preact Redux but I'm not 100% sure of that, and the test suites would need to be adapted to support Preact X..(so breaking the compatibility with Preact 8), which I will try to fix in the next weeks.

fjorgemota avatar Apr 17 '19 00:04 fjorgemota

@fjorgemota Any Updates regarding the fix. I can't use react-bootstrap4-modal package with preact-redux. It works fine without connect.

WaqarHassan avatar May 29 '19 12:05 WaqarHassan

To anyone interested on this issue: could you test if the PR #48 works for you?

When merged that PR should fix this issue, I think.

fjorgemota avatar Jan 20 '20 13:01 fjorgemota