-
Notifications
You must be signed in to change notification settings - Fork 119
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
Warnings shown when embedding wrapper child components #43
Comments
Hi @nzayatz14, |
Ahh interesting, thank you. For anyone that may come across this while struggling with the You could also just pass the |
Another heads up that may be related to this @supersnager. I noticed that when I build for production, it looks like the custom components I have do not show up. I created separate components for my conversation header and input container of my chat. The dev build looks like: Whereas the production build shows: Any ideas? I feel like the components may be doing something wonky with the getChildren function and Typescript may be having some issues with it. |
Hey @nzayatz14, If you are using the as parameter with the type:
try to use a string instead:
|
I actually passing the string currently. Heres a skeleton of my component <ChatContainer>
<ChatHeader
as='ConversationHeader'
//other props
/>
//MessageList and messages
<ChatInputToolbox
as='InputToolbox'
//other props
/>
</ChatContainer> |
@nzayatz14 How you build your app for production? You are using CRA or something else? |
Yes, just using create-react-app so pretty standard I'd imagine. Also heres my tsconfig if this helps {
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"noFallthroughCasesInSwitch": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"baseUrl": "."
},
"include": [
"src"
]
} |
@supersnager so after digging into this a bit, it looks like your getChildren function is relying on the code to not be minified. However, the Heres an example of the minified vs unminified classes: Minified Non-minified So, in your getChildren function when you are looping through the var strTypes = types.map(function (t) {
return t.name || t.displayName;
}); Your result is not quite what you'd expect: Not sure how you want to move forward with this information, but what I've seen from most packages that have specified child props is they will throw a warning on the development build saying something like Hope this helps |
…duction build This is fix for #43. Added displayName for some components and changed getChildren function. Added information in code of conduct.
## [1.8.1](v1.8.0...v1.8.1) (2021-06-03) ### Bug Fixes * **as:** custom component aliased with string is not displayed in production build ([cbf8a04](cbf8a04)), closes [#43](#43)
@nzayatz14 Please check the 1.8.1 version, and let me know if it works for you. |
@supersnager this appears to fix the production build issue, thanks! |
…duction build This is fix for chatscope#43. Added displayName for some components and changed getChildren function. Added information in code of conduct.
## [1.8.1](chatscope/chat-ui-kit-react@v1.8.0...v1.8.1) (2021-06-03) ### Bug Fixes * **as:** custom component aliased with string is not displayed in production build ([cbf8a04](chatscope@cbf8a04)), closes [chatscope#43](chatscope#43)
Hi again,
This is not really an issue but more of an opinion. I've noticed some warnings are being shown when embedding "invalid" child elements into some components. Something like:
My issue here is that this warning is shown if I try to wrap my components for custom logic or even just for cleaner code. For example, the following component would throw this warning.
Are these warnings shown on the production build as well? Or only the dev build?
Thanks!
The text was updated successfully, but these errors were encountered: