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

Release 3.0 #12359

Merged
merged 2,192 commits into from
May 23, 2024
Merged

Release 3.0 #12359

merged 2,192 commits into from
May 23, 2024

Conversation

denihs
Copy link
Contributor

@denihs denihs commented Dec 12, 2022

This PR was Merged before it was ready, but re-opened here

Still in development

Current released version: 3.0-rc.2
To use it, please do a

meteor update --release 3.0-rc.2

you can also use the following command to install meteor RC

npx meteor@rc

Highlights

TODO
See more in the milestones.

Preview docs: https://v3-docs.meteor.com/

Maintainers checklist

⚠️⚠️⚠️ You can follow the updates on What's left until an official Meteor 3.0? Discussion

@github-actions github-actions bot temporarily deployed to pull request January 19, 2023 12:26 Inactive
@github-actions github-actions bot temporarily deployed to pull request January 19, 2023 19:51 Inactive
@StorytellerCZ StorytellerCZ added this to the Release 3.0 milestone Jan 27, 2023
@github-actions github-actions bot temporarily deployed to pull request February 27, 2023 14:06 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 27, 2023 14:08 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 27, 2023 14:12 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 27, 2023 14:13 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 27, 2023 14:30 Inactive
@github-actions github-actions bot temporarily deployed to pull request February 27, 2023 14:34 Inactive
Copy link
Collaborator

@radekmie radekmie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the Minimongo and Mongo packages and added a few comments. Most of them have many instances but I added only one comment each.

I also think that we should focus on addressing the comments from #12471 first, as some things are still relevant, e.g, some sort of a future object for this code:

let promiseResolver = null;
const awaitablePromise = new Promise(r => promiseResolver = r);

Comment on lines 294 to 324
if (Meteor.isClient) {
return function(/* args*/) {
if (self.collection.paused) {
return;
}

const args = arguments;

self.collection._observeQueue.queueTask(() => {
fn.apply(this, args);
});
};
}

return function(/* args*/) {
if (self.collection.paused) {
return;
}

let resolve;
const promise = new Promise(r => resolve = r);

const args = arguments;

self.collection._observeQueue.queueTask(() => {
fn.apply(this, args);
resolve();
});

return promise;
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Client-specific code is basically the same except it returns a Promise instead of nothing. I guess we could always return a Promise then?
  2. The first case (!fn) should return a Promise as well then.

Comment on lines 348 to 357
// it means it's just an array
if (query.results.length) {
for (const doc of query.results) {
await handler(doc);
}
}
// it means it's an id map
if (query.results?.size?.()) {
await query.results.forEachAsync(handler);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have a helper for that, i.e., forEachAsync that works on arrays and IdMaps.

Comment on lines +100 to +106
async findOneAsync(selector, options = {}) {
if (arguments.length === 0) {
selector = {};
}
options.limit = 1;
return (await this.find(selector, options).fetchAsync())[0];
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the plan is to remove the non-async functions at some point, then we should copy the comments as well.

options.limit = 1;
return (await this.find(selector, options).fetchAsync())[0];
}
prepareInsert(doc) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Such helpers should either be lifted into non-prototype functions or at least get prefixed with _ to indicate their "privateness". I'd rather go with the first option.

Also, copying all these functions results in not only duplicated code but also a potential for divergence (someone will change only one of the implementations). How about somehow making one of them use the other? Or at least have a shared helper, so the differences would be minimal?


return id;
}
async insertAsync(doc, callback) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no need for *Async functions to accept callbacks. It was also raised on forum a couple of times.

Comment on lines +420 to 427
async resumeObserversServer() {
this._resumeObservers();
await this._observeQueue.drain();
}
resumeObserversClient() {
this._resumeObservers();
this._observeQueue.drain();
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could remain a single function, if the last line was returned instead of called.

Comment on lines +1527 to +1542
const check = suppressed || !(observeCallbacks.addedAt || observeCallbacks.added)
if (check) {
return;
}

const doc = transform(Object.assign(fields, {_id: id}));

if (observeCallbacks.addedAt) {
observeCallbacks.addedAt(
doc,
indices
? before
? this.docs.indexOf(before)
: this.docs.size()
: -1,
before
doc,
indices
? before
? this.docs.indexOf(before)
: this.docs.size()
: -1,
before
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we should get rid of such changes to make this PR smaller and potentially easier to review by more people.

Comment on lines +74 to +78
fluffyKitten_id = await c.insert({type: 'kitten', name: 'fluffy'});
await c.insert({type: 'kitten', name: 'snookums'});
await c.insert({type: 'cryptographer', name: 'alice'});
await c.insert({type: 'cryptographer', name: 'bob'});
await c.insert({type: 'cryptographer', name: 'cara'});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is insert synchronous or asynchronous? I'm confused after seeing this test.

If it remained synchronous, but the results are not available synchronously, that's a huge change.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK the insert should not be used anymore, but replaced by insertAsync. To keep the same API from the server both places now are only async.

test.equal(c.find().count(), 5);
test.equal(c.find({type: 'kitten'}).count(), 2);
test.equal(c.find({type: 'cryptographer'}).count(), 3);
test.length(c.find({type: 'kitten'}).fetch(), 2);
test.length(c.find({type: 'cryptographer'}).fetch(), 3);
test.equal(fluffyKitten_id, c.findOne({type: 'kitten', name: 'fluffy'})._id);

c.remove({name: 'cara'});
await c.removeAsync({name: 'cara'});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about keeping this file only about the synchronous methods and keep the async ones in packages/minimongo/minimongo_tests_client_async.js?

@github-actions github-actions bot temporarily deployed to pull request March 1, 2023 18:37 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 21, 2024 13:21 Inactive
…pendency-constraint-local-errors

Improve error when local package has inconsistent dependency constraints
@github-actions github-actions bot temporarily deployed to pull request May 21, 2024 13:59 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 21, 2024 13:59 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 21, 2024 14:30 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 21, 2024 14:30 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 21, 2024 15:46 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 21, 2024 15:46 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 22, 2024 12:59 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 22, 2024 12:59 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 22, 2024 13:17 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 22, 2024 13:17 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 22, 2024 23:03 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 22, 2024 23:03 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 23, 2024 14:53 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 23, 2024 14:54 Inactive
@denihs denihs merged commit 28485c2 into devel May 23, 2024
19 checks passed
This was referenced May 23, 2024
@github-actions github-actions bot temporarily deployed to pull request May 23, 2024 16:34 Inactive
@github-actions github-actions bot temporarily deployed to pull request May 23, 2024 16:35 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment