Issue with if else block in handlebars for messaging feature on social media app. Despite passing empty array of messages from controller, always hitting the else statement. Tried various combinations but still not working. What's the problem?
{{#if messages.length}}
<p>if statement</p>
<div class="message-container card" id="{{this._id}}">
<p> Start a new conversation </p>
</div>
{{else}}
<p>else statement</p>
{{#each messages}}
<div class="message-container card" id="{{this._id}}">
<div class="profile-picture">
<img src={{user.profilePicture}} width="100"
height="100"
class="rounded-circle"/>
</div>
<div class="message-header">
<span class="name">{{this.sender.firstName}} {{this.sender.lastName}}</span>
<div class="date-sent">{{this.createdAt}}</div>
</div>
<div class="post-body">
<p class="message">
{{this.message}}
</p>
</div>
</div>
{{/each}}
{{/if}}