meteor / react-packages

Meteor packages for a great React developer experience
http://guide.meteor.com/react.html
Other
574 stars 159 forks source link

feat(react-meteor-accounts): fixes types, deps; adds React check, loggingIn/Out sources, tests #348

Closed WilliamKelley closed 2 years ago

WilliamKelley commented 2 years ago

Apologies for a large PR. I can split it up if needed.

Accomplished tasks:

Outstanding tasks:

Further considerations:

CaptainN commented 2 years ago

I'll review this soon. There's a lot!

WilliamKelley commented 2 years ago

I'll review this soon. There's a lot!

Definitely. I took care so the changes are mostly reviewable by commit. Exceptions are the type signatures of HOCs and the tests. Those took some refinement over many of the later commits.

WilliamKelley commented 2 years ago

Fixed TS excluding null from the returns types of Meteor.userId / Meteor.user and needing to manually annotate that. The issue was turning on a compiler flag for "strict null checking" or the "strict" compiler option in general. Apparently it's recommended, but opt-in behavior.

WilliamKelley commented 2 years ago

Removed module augmentation for Meteor.loggingOut -- turns out it is documented in @types/meteor, I guess my IDE was just lagging.

I updated WithUserProps to be a null union with Meteor.User


I also made a PR to include Meteor.loggingOut in Meteor's online API docs. I will update the JSDoc summary with the link once/if merged.

CaptainN commented 2 years ago

I'll try to get to this soon. I haven't forgotten about it.

WilliamKelley commented 2 years ago

No problem.

For pre-review consideration,

Additionally, I'm conflicted on the appropriate-ness of my tests. They pretty much just test underlying behaviors. However when the function boils down to a simple piping of output, then there's not really a unit test to write that doesnt mean stubbing everything or feeling like results aren't manufactured. If you want the tests to look any other way, I'm totally on board. However these can still be useful to illustrate typical lifecycles for consumers.

CaptainN commented 2 years ago

I took a pretty close look at this - it all looks great! Some of the TS stuff also looks good - worth noting - we don't use that for anything... Atmosphere doesn't support TS yet. But you could generate types and submit them to definitely typed if you like.

As far as removing the HoCs - IDK, they are already written, and I doubt they take up much space, but I'd be fine with it. Let's get the opinion of some of the others though before taking it out.

I say we ship this. Thanks for all the work! This looks great.

StorytellerCZ commented 2 years ago

I concur with @CaptainN, especially in regards to HOCs. They exist, they are being used and not going anywhere. Let's not break backward compatibility here needlessly.

CaptainN commented 2 years ago

I'm going to merge this to the other PR - and we can finish it up there.