Kelvin Zhao
Kelvin Zhao

Reputation: 2435

Does Meteor.call affect optimistic UI?

When I do a Meteor.call instead of a direct collection manipulation on both client and server. Does it remove the optimistic UI changes, aka minimongo changes and simply does direct to server change and wait for update on server before updating the UI?

Upvotes: 3

Views: 494

Answers (1)

Lucas Blancas
Lucas Blancas

Reputation: 561

Read the last section of this Meteor doc about 'How latency compensation works'

In Summary

You do lose optimistic data changes as you suspected if your Meteor.method is defined server-side only. In this case, when your client calls the method, you are essentially calling an REST service and waiting for the server-side response before your client can process the response.

When you do a client-side collection manipulation, client-side simulates the changes in minimongo, then tells the server to change the collection, then server updates the client with the server side changes (accepted or rejected).

Note: If you share Meteor.method to client and server, you can get optimistic nature. I've never done this, but read the link

Upvotes: 5

Related Questions