question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pattern for removing temporary messages once app receives response from server

See original GitHub issue

Hello, first of all thank your for this great lib. I have a question on what pattern makes sense to maintain temporary messages state. Given that a temporary message is added to the messages prop the moment the user hits the send button but before the response is returned to the app there is no way to generate a matching ID locally (the server will return with its own messageID). What patterns are recommended to remove the temporary message?

Approach 1 match message text value

Off the top of my head I thought of matching the actual message text in order to remove the temporary message (once the response is received), but that does not feel right.

Approach 2 replace entire messages array with response

Replacing the entire messages array with what is returned from the network also does not take into account if the request failed

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
shaheem-khanzadacommented, Oct 3, 2018

@waltermvp use renderFooter(){} to show local message in a list , when u press send button u get a local message from props save that message in a state and then use condition
<giftedChat> {...props} renderFooter={this.state.localMessage.length > 0 ? this.renderFooter() : null} </giftedChat>}

0reactions
deepak-jha-kgpcommented, May 28, 2019

@nandiniparimi1107 you need to pass this.isTyping as extraData in giftedChat

Read more comments on GitHub >

github_iconTop Results From Across the Web

Amazon SQS temporary queues - AWS Documentation
The most common use case for temporary queues is the request-response messaging pattern, where a requester creates a temporary queue for receiving each...
Read more >
Scalable Request Response pattern using Azure Service Bus
To make this work, we will have to have one Request queue and multiple topics (one for each web server instance). This will...
Read more >
Asynchronous messaging options - Azure Architecture Center
Learn about asynchronous messaging options in Azure, including the different types of messages and the entities that participate in a messaging ...
Read more >
Part 4: RabbitMQ Exchanges, routing keys and bindings
Auto-deleted exchanges are removed once the last bound object is ... The exchange receives the message and is now responsible for the ...
Read more >
Messaging - Apache Pulsar
Then, this consumed message will be permanently stored, and be deleted only after all the subscriptions have acknowledged it. If you want to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found