-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
Meteor methods with client stubs not supported for waitOn()? Promise not resolved Error: Can't set timers inside simulations #112
Comments
@drone1 generally I'd say — Use stubs only for user-interaction actions. |
Hey @dr-dimitru! Maybe it would be helpful to throw an exception before Meteor.setTimeout() if in simulation? I'm not sure if this is an easy one-liner, since the code is running outside of a method, you may not be able to check The behavior I'd expect is to not get an exception thrown by Meteor.setTimeout() being called, and the code moving along as expected as data comes back from the server. The Meteor docs recommend client stubs for all methods IIRC so I'd gotten into the habit of doing that. Thanks for getting back. |
@drone1 Do you want to push a PR? |
@drone1 I tested it with all works as expected, no error thrown, please check at your end |
I think you may have replied to the wrong thread here? |
@drone1 no, I tested simulated "stub" Methods on client |
Okay. I was saying that in the case I described it would be helpful if it threw an error, not that it threw an error. |
You clearly mention exception in your original issue report, and asking to support "client stubs". Am I missing something here? |
Ah sorry, I was referring to this. |
@drone1 I need more details on what we are trying to fix here. As of now I do not understand. As far as I see if Method defined on Client and Server it means we want to run it as simulation, if not — it should get defined on Server only. Either way FlowRouter should accept any Promises in |
I’ll get you more details but this issue is super low priority IMO compared
to the other one I submitted where the yield breaks in Meteor 3 :)
…On Tue 4. Feb 2025 at 07:49, dr.dimitru ***@***.***> wrote:
@drone1 <https://github.com/drone1> I need more details on what we are
trying to fix here. As of now I do not understand. As far as I see if
Method defined on Client and Server it means we want to run it as
simulation, if not — it should get defined on Server only. Either way
FlowRouter should accept any Promises in waitOn hook and wait for all to
resolve, isn't it?
—
Reply to this email directly, view it on GitHub
<#112 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABQIEPDHC5W3ZVHGHXJMFVT2OBPH5AVCNFSM6AAAAABV4YEUVSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMZTGAZDGMZWGM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I'm having an issue:
flow-router-extra
you're experiencing this issue: 3.9.0 and 3.10.1Meteor
you're experiencing this issue: 2.15This does not work for me:
methods.js (imported on both client and server):
routes.js, imported on the client:
Exception thrown, since you are calling Meteor.setTimeout here:
If I change the Meteor method to have no client stub, the exception goes away:
(...routes.js same as above...)
methods.js
Definiing waitOn() as follows instead does NOT seem to cause the exception:
Originally I was definiing waitOn() with
return new Promise(async (resolve, reject) => ...
and calling a ValidatedMethod, which always defines a client stub as far as I can tell, likeawait myValidatedMethod.callAsync()
, which caused this exception.Would be great if you could support client stubs, but anyway, any suggestions here? Am I doing something unreasonable? Thanks.
The text was updated successfully, but these errors were encountered: