-
-
Notifications
You must be signed in to change notification settings - Fork 148
Children is array. #242
Comments
Hi @BANG88 - sorry for letting this issue slip through the cracks! Children should be normalized to look like React's, but it seems like there's a combination of components that circumvents that normalization. I'll look into it! |
@developit any idea what combination of components might be causing this? I've having the same issue (with the same component, |
Hey - best possible thing would be a stack trace from the point where children was seen as an array. |
@developit thanks, doing that now. Here's the stack trace if you want to check it out:
|
hmm - interesting that it's happening when rendering to string. Will see if that could be related! |
Little confused how How are you aliasing |
That's probably the issue, I'm using webpack aliases for the client bundle, but we don't bundle our server code. Instead we're using I'm trying to get the server's babel config setup to alias
But it doesn't seem to change that |
It might be related to our |
Ahh yes. I was trying to recall if there was a good require alias module for node. I know I've used a few, but it's difficult thing to search for. |
I went ahead and just monkey-patched it myself, and it does work now! Not a great long term solution, but it's better than nothing I suppose 😄 var Module = require("module");
const originalRequire = Module.prototype.require;
Module.prototype.require = function() {
if (arguments[0] === "react" || arguments[0] === "react-dom") {
arguments[0] === "preact-compat";
}
if (arguments[0] === "react-dom/server") {
arguments[0] = "preact-compat/server";
}
return originalRequire.apply(this, arguments);
} So I think it's safe to say this error is likely due to edit: it does look like something is going wrong with server rendering though, as I'm getting back |
Hmm - what are you calling for your server render? |
@developit sorry for the noise, it looks like we were using some internal React modules in electrode-react-ssr-caching and that was causing the issue. |
I am seeing the same issue using Monkey-patching require using module-alias seems to fix the issue. Does the issue lie with |
@ryan-codingintrigue The issue is that Babel (as applied via |
Makes sense thanks! Will leave the require hook in place then, as I'm using Webpack on the front end anyways. |
Yup! FWIW, if you were you bundle with Webpack (or reuse your frontend bundle as a UMD bundle), those aliases would work in Node. A lot of people use that technique via static-site-generator-webpack-plugin. |
Should we close this issue? It seems like the underlying cause is usually a broken alias. |
Closing since the cause is a broken alias. Please re-open if it's still an issue! |
Same code works well with
React
but not work withPreact-compat
.When use
Preact
withreact-redux
it seems like:When use
React
:ENV:
The text was updated successfully, but these errors were encountered: