messages the search button doesnt work
3
zfrika
The issue in your code is that your messages are inconsistent—likely, received messages might be missing a to property, or sent messages might be missing a from property. When JavaScript tries to run .toLowerCase() on a property that doesn't exist, it crashes the whole function. Here is the fixed version of your updateMessagesList method. I have added Optional Chaining (?.) and fallback empty strings || '' to ensure the search is "bulletproof."