- use Meteor._debug instead of console.warn

- add comments to not change the behavior of withValues() (client)
This commit is contained in:
denihs
2024-06-26 14:08:50 -04:00
parent b6a3638c0f
commit ec0d28cadd
2 changed files with 5 additions and 1 deletions

View File

@@ -614,7 +614,7 @@ export class Connection {
stubOptions.stubReturnValue = DDP._CurrentMethodInvocation
.withValue(invocation, stubInvocation);
if (Meteor._isPromise(stubOptions.stubReturnValue)) {
console.warn(
Meteor._debug(
`Method ${name}: Calling a method that has an async method stub with call/apply can lead to unexpected behaviors. Use callAsync/applyAsync instead.`
);
}

View File

@@ -35,6 +35,10 @@ EVp.getOrNullIfOutsideFiber = function () {
* @returns {any} The return value of the function
*/
EVp.withValue = function (value, func) {
// WARNING: Do not change the behavior of this function.
// If you compare this function to it's version in the server-side, you'll see that there we handle async results.
// In the client we don't need to do this. If we try to, it can lead to problems like this:
// https://github.com/meteor/meteor/pull/13198#issuecomment-2181254734/.
var saved = currentValues[this.slot];
try {