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

Meteor 3.0 support #12

Closed
welkinwong opened this issue Aug 13, 2024 · 16 comments
Closed

Meteor 3.0 support #12

welkinwong opened this issue Aug 13, 2024 · 16 comments

Comments

@welkinwong
Copy link

hope support meteor 3.0 🥺🥺🥺

Copy link

Thank you for submitting this issue!

We, the Members of Meteor Community Packages take every issue seriously.
Our goal is to provide long-term lifecycles for packages and keep up
with the newest changes in Meteor and the overall NodeJs/JavaScript ecosystem.

However, we contribute to these packages mostly in our free time.
Therefore, we can't guarantee your issues to be solved within certain time.

If you think this issue is trivial to solve, don't hesitate to submit
a pull request, too! We will accompany you in the process with reviews and hints
on how to get development set up.

Please also consider sponsoring the maintainers of the package.
If you don't know who is currently maintaining this package, just leave a comment
and we'll let you know

@copleykj
Copy link
Member

This is on my todo list but changes to move away from Fibers/Futures will be necessary. Unfortunately my current paid workload has not allowed me to explore what these changes might be as of this time.

@copleykj
Copy link
Member

Update: I've started work on this. Not sure how fast it will progress as it will require updates across dependencies as well. Will try to update here as I make progress.

@copleykj
Copy link
Member

Update 2: Making some pretty good progress with this packages, as well as picker and inject-data which this relies on. At this point I'm working on satisfying the last 3 tests, 1 on the server and 2 on the client.

@copleykj
Copy link
Member

Update 3: Still progressing on this. All server tests pass and data is getting properly sent to the client for both null publications and subscriptions that run on the server via using fast-render's publication mechanism. The final issue will be solving calling Meteor.subscribe on the server for things like server rendering, since it there is no real way to await a subscribe call, and the API needs to match the client side API so that code can match isomorphically.

I'm starting to run short on free time at the moment and so I'm going to estimate that we are looking at around 3 weeks before I can get this fully completed.

@welkinwong
Copy link
Author

@copleykj hello, I send you an email, maybe you not receive

I love the package
are you have time to update recently?
I can sponsoring $150 to that 😊

@copleykj
Copy link
Member

Hey @welkinwong, I'm currently working on this, I just have one race condition that I'm having an issue figuring out how to correct it. Not sure how long it will take, but I will keep trying till I figure it out.

@henriquealbert
Copy link

henriquealbert commented Sep 27, 2024

could you share what is blocking you @copleykj ?
I can try to reach out to one of the core members of Meteor to help you with this 😄

@copleykj
Copy link
Member

copleykj commented Sep 27, 2024

@henriquealbert I think at the moment I'm in a good spot. I'm in the process of fixing some tests and potentially moving them from tinytest to mocha so that they all run on the same driver. The one thing I'm not sure about how to handle is server side Meteor.subscribe, but that only comes into play for server rendering and I think issuing a release that doesn't initially support SSR might be ok and then that can be added once I get my head around how waiting on subscribe functions can be handled.

@copleykj
Copy link
Member

Most everything is in order here... I've rewritten all the tests and they all pass. I've published both communitypackages:picker, and communitypackages:inject-data. communitypackages:fast-render however is giving me an issue where it wants a constraint applied to the livedata package. This shouldn't be the case as api.versionsFrom should handle this since it's a core package. I've tried adding a version just to see if it would help, but it makes it worse. Once I've sorted this out I can publish the beta and @welkinwong, you can begin testing the package out.

@wreiske
Copy link

wreiske commented Oct 2, 2024

I have a project without any SSR that I'd love to test this on... I spent a ton of time re-writing fast render to use async / await instead of fibers, but haven't been able to reliably get the subscribe to work on the server side so the inject-data outputs into the page. I am hoping that your work @copleykj will allow me to ditch my broken code 😆 .

@copleykj
Copy link
Member

copleykj commented Oct 2, 2024

@wreiske so I'm still not able to publish the beta here due to the livedata constraint issue I'm having. That being said the 2 packages that this relies on did publish and so if you'd like to try it, you should be able to clone this repo into a packages dir and test it. One caveat may be the need to the project to be running on Meteor 3, but as long as that is the case this should work.

@wreiske
Copy link

wreiske commented Oct 2, 2024

OK - I checked out the v5 branch. I'm not sure if the onAllRoutes is working.

Changes to your project's package version selections:
                                              
communitypackages:fast-render   added, version 5.0.0-beta.0
communitypackages:inject-data+  added, version 3.0.0-beta.0
communitypackages:picker+       added, version 2.0.0-beta.0
livedata+                       added, version 1.0.11-pre.1
montiapm:meteorx                added, version 2.3.1
server-render                   added, version 0.4.2

                                              
+ In order to resolve constraints, we had to use experimental versions of these
packages.
<script type="text/inject-data">%7B%22fast-render-data%22%3A%7B%22collectionData%22%3A%7B%7D%2C%22subscriptions%22%3A%7B%7D%2C%22loginToken%22%3A%226mk8GXSb6SzNJLmfb_x28pCGvR2PB9wIo4RG4_g8RYy%22%7D%7D</script>

I have simply:

import {
    FastRender
} from 'meteor/communitypackages:fast-render';

FastRender.onAllRoutes(function () {
    console.log('Fired onAllRoutes', this.userId);
    if (!this.userId) {

        console.log('No user id, returning');
        return;
    }
    this.subscribe('UserData');
});

... and ...

Meteor.publish('UserData', function () {
    if (!this.userId) {
        return this.ready();
    }

    console.log('Calling UserData for ', this.userId);

    return Meteor.users.find({
        _id: this.userId
    }, {
        fields: {
            emails: 1,
            profile: 1,
        }
    });
});

I see in my logs:

I20241002-01:11:05.214(0)? Fired onAllRoutes FQZPiRk46xdECpDpN
I20241002-01:11:05.215(0)? Calling UserData for  FQZPiRk46xdECpDpN

@wreiske
Copy link

wreiske commented Oct 2, 2024

Figured it out!!!

FastRender.onAllRoutes(async function () {
    console.log('Fired onAllRoutes', this.userId);
    if (!this.userId) {

        console.log('No user id, returning');
        return;
    }
    await this.subscribe('UserData');
});

🥳

@copleykj
Copy link
Member

copleykj commented Oct 2, 2024

Awesome 😎

Let me know if you find any other issues 🙏

@copleykj
Copy link
Member

copleykj commented Oct 4, 2024

Version 5.0.0-beta.0 has been published. I'm going to close the few 3.0 support issues. If you find any issues that aren't related to SSR please open new issues for them.

@copleykj copleykj closed this as completed Oct 4, 2024
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

4 participants