Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Methods don't appear to be Optimistic #18

Open
jamauro opened this issue Dec 8, 2022 · 0 comments
Open

Methods don't appear to be Optimistic #18

jamauro opened this issue Dec 8, 2022 · 0 comments

Comments

@jamauro
Copy link

jamauro commented Dec 8, 2022

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,
    });
  },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant