-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
🪟 🔧 Add Segment event to invite users modal #18862
🪟 🔧 Add Segment event to invite users modal #18862
Conversation
@@ -19,7 +19,9 @@ export const useInviteUsersModalService = () => { | |||
return ctx; | |||
}; | |||
|
|||
export const InviteUsersModalServiceProvider: React.FC<React.PropsWithChildren<unknown>> = ({ children }) => { | |||
export const InviteUsersModalServiceProvider: React.FC< | |||
React.PropsWithChildren<unknown> & { invitedFrom: "source" | "destination" | "user.settings" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We try to always exclude properties into their own interface, i.e. as a InviteUsersModalServiceProviderProps
. Also that interface, should be used as the generic type for PropsWithChildren
instead of intersected with it, i.e. React.FC<React.PropsWithChildren<InviteUsersModalServiceProviderProps>>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll make the change 😊
Could you explain why we prefer to/should use the interface as the generic type?
I'm super interested in learning more about Typescript as I'm fairly new to it and don't usually use more than basics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The React.PropsWithChildren
's sole purpose is basically to wrap the properties and add children
to those props, so doing React.PropsWithChildren<unknown> & { ... }
is kind of like saying: I have the perfect template for a shopping list at home, and when going to the shop I take that (empty) template and my actual list ("Manolitos, Manolitos, and more Manolitos") that I wrote on a completely blank second paper. (I'll let you know once I come up with a better analogy.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great analogy! Totally understood! thanks for taking the time to explain it 😊
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left a comment about code style that should be addressed. Other than that looks good to me. Have not tested locally.
909fdc0
to
1af5dbd
Compare
Demo: https://www.loom.com/share/1e899c9678124321a62dc71d23bfe52e
What
Adding a new
Airbyte.UI.User.Invite
Segment event to be able to track user invites across sources, destinations and access management pages.How
Add new event
Add tracking on invite