Methods don't appear to be Optimistic
jamauro opened this issue · 0 comments
jamauro commented
I don't believe the Methods are imported anywhere on the client so you can't take advantage of Optimistic UI. I think the intent is to take advantage of it since it's a key selling point of Meteor and the language in the tutorial makes it sound like you are using it.
As far as I can tell, this applies to all the tutorials.
If I'm missing something let me know but I made this change to test the insert
'tasks.insert': async function(text) {
check(text, String);
if (!this.userId) {
throw new Meteor.Error('Not authorized.');
}
if (this.isSimulation) {
console.log('simulation');
} else {
console.log('on the server');
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
await wait(2000);
console.log('done waiting')
}
TasksCollection.insert({
text,
createdAt: new Date(),
userId: this.userId,
});
},