Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
componentDidUpdate(prevProps) {
if (
(_.isEmpty(this.state.conversations) &&
this.state.conversationsFetched === false) ||
(this.props.lastMessageId !== prevProps.lastMessageId)
) {
var conversationsRequest = new CometChat.ConversationsRequestBuilder()
.setLimit(50)
.build();
conversationsRequest.fetchNext().then(
conversationList => {
this.setState({
conversations: conversationList,
conversationsFetched: true
});
},
error => {
this.setState({
conversations: [],
handleSearchStringChange = e => {
this.setState({ searchString: e.target.value });
let search_string = e.target.value;
var conversationsRequest = new CometChat.ConversationsRequestBuilder()
.setLimit(100)
.build();
conversationsRequest.fetchNext().then(
conversationList => {
let keys_to_remove = [];
if(conversationList.length > 0)
{
_.forEach(conversationList, function(c,k) {
if(_.toLower(c.conversationWith.name).indexOf(_.toLower(search_string)) < 0)
{
keys_to_remove = _.concat(keys_to_remove, k);