-
Notifications
You must be signed in to change notification settings - Fork 13
Disable new organization button if user doesn't have write on the silo #1244
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
24407ee
to
f531ea9
Compare
<Button size="sm" disabled> | ||
New Organization | ||
</Button> | ||
)} |
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.
Clearly this is too noisy — we'd want to wrap this up into a disable-able custom link component with a disabled
prop and a message to show in a tooltip when disabled.
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.
Disabled links are a bit of an odd pattern. We'd want to change the pointer and ensure we had aria-disabled
present. I think it's definitely something we'd want to try out on a screen reader just to see what it resulted in.
f531ea9
to
02db030
Compare
await Promise.all([ | ||
apiQueryClient.prefetchQuery('organizationList', { query: { limit: 10 } }), | ||
apiQueryClient.prefetchQuery('policyView', {}), | ||
]) |
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.
prefetch silo policy
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.
Worth a comment?
return me && myGroups && siloPolicy | ||
? userRoleFromPolicies(me, myGroups.items, [siloPolicy]) | ||
: null | ||
} |
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.
all of these requests are prefetched and therefore never undefined
, but we don't know it statically
Proof of concept.