Closed WilliamKelley closed 2 years ago
I'll review this soon. There's a lot!
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.
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.
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.
I'll try to get to this soon. I haven't forgotten about it.
No problem.
For pre-review consideration,
useTracker
can cut the code by 3/4 probably.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.
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.
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.
I'm going to merge this to the other PR - and we can finish it up there.
Apologies for a large PR. I can split it up if needed.
Accomplished tasks:
"accounts-base"
.Meteor.*
.null
from the returns types ofMeteor.userId
/Meteor.user
, not sure why... but that's why the corresponding hooks have explicit signatures~ Edit: SolvedMeteor.loggingIn
,Meteor.loggingOut
Meteor.loggingOut
isn't declared in@types/meteor
(or in the online docs for that matter), but it does exist and it is useful -- hence the TS module augmentation.~ Edit: SolvedOutstanding tasks:
react-meteor-accounts
butpackage.js
saysreact-accounts
."meteor/react-meteor-accounts"
,react-trackers-accounts
,react-accounts-trackers
. I'll leave up to maintainers.use/withUser
should implementation([options])
for optional field projection, likeMeteor.user
.useTracker
oruseFind
is brought in withreact-meteor-accounts
as a dep.Further considerations:
react-router
advises ifwithRouter
is needed by v6 consumers. This has an additional benefit: consider a consumer needs a combination of these HOCs. They must compose that combination of our HOCs. This can be unwieldly if they need all 4, and can be suboptimal to callforwardRef
four times.react-router
. This establishes better patterns for consumers and eases our implementation and testing burden.