im trying to fetch data asychronisouly twitter rest api (fetching my tweets to be more specific), and after i do so, i display them as cards. My problem is when i delete a tweet, it does not reflect in my application.
not necessarily deleting a tweet, but even adding a tweet too. since the app is based on multiple user, if another user adds a tweet, it should refresh automatically an the other user should see that tweet that was added.
I don’t see it adding anything anywhere. All I see it doing is creating and returning an extraneous Promise, although the function signature doesn’t even tell us it’s going to do so.
sorry for not being very clear, i am doing a POST request to my google cloud functions and i also pass the user details that will be added in the tweet. So my code in cloud functions is basically resposible for adding the new tweet.
the cloud functions response is just a string that user was added not much to it.
(a) every time you POST an addition or deletion, you also emit off a local Observable in the tweet provider reflecting that change, so you are basically keeping up a local shadow copy of the data backing your list, or;
(b) every time you have completed a POST for an addition or deletion, you go back and ask the outside world for a new copy of the data backing your list.
If I as a reader can’t tell that addTweet() is intended to modify dataFromTwitter somehow, then I can’t see how dataFromTwitter is ever going to get that message either.