fix: Fix rendering bug in Conversation.tsx by replacing forEach with map#82
fix: Fix rendering bug in Conversation.tsx by replacing forEach with map#82chenura999 wants to merge 1 commit intoSnapchat:mainfrom
Conversation
|
This change from There's actually a fundamental difference between React and Valdi here. In Valdi, Component In terms of functional programming, the render output is a side-effect of the tree constructed by components. You can actually use This is valid code in Valdi: onRender() {
for (const item of this.state.items) {
<label value={time.label} />;
}
}Another example from our docs: for (let i = 0; i < 3; i++) {
const dog = 'https://placedog.net/50' + i;
<image src={dog} height={64} width={64} border='1 solid red' />;
}
}If you are seeing an empty view with A better change for this component would be to remove |
Summary
Fixes a critical bug in Conversation.tsx where chat messages were failing to render.
Problem
The message list was being iterated using
.forEach(), which returnsundefinedand produces no output in the JSX. This caused the chat interface to appear empty even when messages existed in the state.Solution
Replaced
.forEach()with.map()to correctly return an array of<Message />components for rendering.Testing
mapis the standard and correct patterns for list rendering in this context.