-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
ref(ui): Extract useOwnerOptions #69269
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
ref(ui): Extract useOwnerOptions #69269
Conversation
This hook may be used to load member and team options for a select component.
Bundle ReportChanges will increase total bundle size by 843 bytes ⬆️
|
/** | ||
* Props to pass to the leading avatar component | ||
*/ | ||
avatarProps?: BaseAvatarProps; |
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.
This seems misplaced. It's weird imo for a hook to return react components and it's a code smell that this function call is just passing along this object into the component. To me is means that there are two jobs happening inside this hook.
What's also a code smell is asking: could someone use this hook for anything other than the SentryMemberTeamSelectorField component and the answer is probably no. We're not returning lists of members + my teams + other teams + disabled teams.... instead it's returning a list of avatars under each category which limits re-use a lot.
I'd make changes to that one file is responsible for importing , and , and the hook is responsible for combining the data fetching, and returns one isFetching
or isLoading
value along with the arrays of objects and filter callbacks.
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.
SentryMemberTeamSelectorField component and the answer is probably no
I'll be using this for a Owners
component as well
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.
Yah I can adjust it a bit to move the option generation to a diff hook
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.
@ryan953 mind if I get this in as is now actually and I'll get a follow up PR up where it separates the options transformation logic?
I'd like to get the owners filter in asap today too
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.
yup, sounds good to me!
Splitting out over to here actually #69348 |
This hook may be used to load member and team options for a select component. This is a spin off of #69269 --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
This hook may be used to load member and team options for a select component. This is a spin off of #69269 --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
This hook may be used to load member and team options for a select component.