A
A
adam_carraway2019-07-11 00:34:25
Vue.js
adam_carraway, 2019-07-11 00:34:25

Is it correct to request ALL data again when changing?

I have a post with comments. In the component, I have a method that requests all post comments via ajax, after receiving them, I display them at the bottom of the post (I use : key when displaying comments). I also have events connected and when a user adds a comment, a notification will be sent from the server to other users. So, is it worth it when adding a comment from other users to re-receive post comments via ajax?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Igor, 2019-07-11
@adam_carraway

Let's assume that there are a lot of comments.
From an economic point of view, it is better to upload a separate comment.
Another thing is that this complicates the task to a degree, no matter what anyone says, when compared with a normal reboot.
Economic components:
1. The amount of information transmitted over the network.
2. It is easier for the database to return 1 record by key. (this will also save a resource)
3. There are fewer movements on the client side.
I will say this, it is better if there is a reload of one comment.

N
NeoArt, 2019-07-11
@NeoArt

Why make another request? After all, with a notification, you can also send a new comment.

M
Maxim Rysakov, 2019-07-11
@Rysakov

Get only new ones, you have the id of the last comment.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question