-
Notifications
You must be signed in to change notification settings - Fork 2
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
Use store instead of props to pass userUUID #19
Conversation
@jhodapp Merged in your ux tweaks. We're good to 🚀 |
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.
Thanks for this David, I left my latest thoughts inline. Let me know what you think.
I know you mentioned this article from Vercel on passing state via Context, but I don't think their example applies directly in this case.
useEffect(() => { | ||
async function loadOrganizations() { | ||
if (!userUUID) return; | ||
const { userUUID } = useAuthStore((state) => state); |
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 still don't prefer to break encapsulation of the SelectionCoachingSession component by directly using useAuthStore()
instead of passing it as a property one level deep. Here's a good explanation of my thought process from Perplexity.ai summarizing other sites on this.
Here's my own thought process: I think it's a logical practice to retrieve state at the page level and pass user session state like userUUID down to components because components are reusable and pages are not. But a component like this one becomes less reusable when tightly coupling the AuthStore into the innards of the component.
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 was able to test this successfully against Jim-Hodapp-Coaching/refactor-platform-rs#50
Awesome work!
Description
Cleans up the
SelectCoachingSession
component to use the Zustand store for grabbing userUUID instead of props.GitHub Issue: [Resolves] #17
Changes
Screenshots / Videos Showing UI Changes (if applicable)
Testing Strategy
describe how you or someone else can test and verify the changes
Concerns
describe any concerns that might be worth mentioning or discussing