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

Preact X, preact-redux is not working.. #42

Open
ohute-couture opened this issue Mar 22, 2019 · 6 comments
Open

Preact X, preact-redux is not working.. #42

ohute-couture opened this issue Mar 22, 2019 · 6 comments

Comments

@ohute-couture
Copy link

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

@Sexual
Copy link

Sexual commented Mar 23, 2019

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

@ohmoses
Copy link

ohmoses commented Apr 2, 2019

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
	}
};

@developit
Copy link
Owner

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

@fjorgemota
Copy link
Collaborator

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.

@WaqarHassan
Copy link

WaqarHassan commented May 29, 2019

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

@fjorgemota
Copy link
Collaborator

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.

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

6 participants