-
Notifications
You must be signed in to change notification settings - Fork 295
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
feat(clerk-js): Use org:sys_domains:read
for improved fine grain control of the UI
#1896
Conversation
🦋 Changeset detectedLatest commit: 9a375d9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 12 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
org:sys_domains:read
for improved fine grain control of the UI
packages/clerk-js/src/ui/components/OrganizationProfile/DomainList.tsx
Outdated
Show resolved
Hide resolved
packages/clerk-js/src/ui/components/OrganizationProfile/DomainList.tsx
Outdated
Show resolved
Hide resolved
}, | ||
]} | ||
/> | ||
showDotMenu ? ( |
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.
🙃 showDotMeny && <JSX/>
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.
Already tried that, seems like trailingComponent
does not accept null, I didn't want to mess with the signature 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.
Why don't we update its types?
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 following has type of false | EmotionJSX.Element | null
showDotMenu && (
<DomainListDotMenu
redirectSubPath={redirectSubPath}
domainId={d.id}
/>
)
So i would have to do
(showDotMenu || null ) && (
<DomainListDotMenu
redirectSubPath={redirectSubPath}
domainId={d.id}
/>
)
Which i'm not convinced it is better
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 am not sure I understand what you are talking about. Is this the type?
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.
@@ -35,7 +35,7 @@ export const useFetch = <T>( | |||
requestStatus.setError(); | |||
setData(null); | |||
}); | |||
}, []); | |||
}, [JSON.stringify(params)]); |
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.
❓ Can you elaborate on this change? Is it necessary to be part of this PR?
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.
Previously useFetch would only fire once, "on mount", there was a bug where the Gate component would not hide the content while not having the necessary permission because the "fetch" wouldn't fire when the parameters changed.
For context we are using useFetch
to handle the async logic of isAuthorized.
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.
Do we need to make a FAPI call every time the isAuthorized
is invoked?
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 would only invoke a call if params change, not on every render.
* @returns {string} Returns the string without leading slashes | ||
* @param path | ||
*/ | ||
export const trimLeadingSlash = (path: string): string => { |
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.
Can we add a couple of tests for this util?
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.
Yeap, thanks for the reminder
a591162
to
d19c8a0
Compare
packages/clerk-js/src/ui/components/OrganizationProfile/DomainList.tsx
Outdated
Show resolved
Hide resolved
}, | ||
]} | ||
/> | ||
showDotMenu ? ( |
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.
Why don't we update its types?
@@ -35,7 +35,7 @@ export const useFetch = <T>( | |||
requestStatus.setError(); | |||
setData(null); | |||
}); | |||
}, []); | |||
}, [JSON.stringify(params)]); |
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.
Do we need to make a FAPI call every time the isAuthorized
is invoked?
}, | ||
]} | ||
/> | ||
showDotMenu ? ( |
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 am not sure I understand what you are talking about. Is this the type?
…ntrol of the UI Backport of #1896
Description
This PR makes usage of
org:sys_domains:read
a permission that allows users to see a list of domains. Previously we were wrapping the whole functionality under themanage
permission.Checklist
npm test
runs as expected.npm run build
runs as expected.Type of change
Packages affected
@clerk/clerk-js
@clerk/clerk-react
@clerk/nextjs
@clerk/remix
@clerk/types
@clerk/themes
@clerk/localizations
@clerk/clerk-expo
@clerk/backend
@clerk/clerk-sdk-node
@clerk/shared
@clerk/fastify
@clerk/chrome-extension
gatsby-plugin-clerk
build/tooling/chore