feat(react-meteor-accounts): fixes types, deps; adds React check, loggingIn/Out sources, tests#348
feat(react-meteor-accounts): fixes types, deps; adds React check, loggingIn/Out sources, tests#348CaptainN merged 21 commits intometeor:react-meteor-accountsfrom WilliamKelley:patch-react-meteor-accounts-2
Conversation
- adjust internal of useUser to fix returning `undefined` after logout (not in signature)
|
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 |
|
Removed module augmentation for I updated I also made a PR to include |
|
I'll try to get to this soon. I haven't forgotten about it. |
|
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. |
|
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.*.Accounts.*instead, but that's also trivial.side note: TS wrongly excludesEdit: Solvednullfrom the returns types ofMeteor.userId/Meteor.user, not sure why... but that's why the corresponding hooks have explicit signaturesMeteor.loggingIn,Meteor.loggingOutTurns outEdit: SolvedMeteor.loggingOutisn'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.Outstanding tasks:
react-meteor-accountsbutpackage.jssaysreact-accounts."meteor/react-meteor-accounts",react-trackers-accounts,react-accounts-trackers. I'll leave up to maintainers.use/withUsershould implementation([options])for optional field projection, likeMeteor.user.useTrackeroruseFindis brought in withreact-meteor-accountsas a dep.Further considerations:
react-routeradvises ifwithRouteris 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 callforwardReffour times.react-router. This establishes better patterns for consumers and eases our implementation and testing burden.