Skip to content

Commit

Permalink
chore(clerk-js): Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef committed Nov 3, 2023
1 parent 904cd28 commit ba188b6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/clerk-js/src/core/resources/Permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class Permission extends BaseResource implements PermissionResource {
key!: string;
name!: string;
description!: string;
type!: 'system';
type!: 'system' | 'user';
createdAt!: Date;
updatedAt!: Date;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,19 @@ export const RoleSelect = (props: {

const shouldDisplayLegacyRoles = !roles;

const legacy_roles: Array<{ label: string; value: MembershipRole }> = [
const legacyRoles: Array<{ label: string; value: MembershipRole }> = [
{ label: 'admin', value: 'admin' },
{ label: 'basic_member', value: 'basic_member' },
];

const legacy_excludedRoles: Array<{ label: string; value: MembershipRole }> = [
const legacyExcludedRoles: Array<{ label: string; value: MembershipRole }> = [
{ label: 'guest_member', value: 'guest_member' },
];
const { localizeCustomRole } = useLocalizeCustomRoles();

const selectedRole = [...(roles || []), ...legacy_roles, ...legacy_excludedRoles].find(r => r.value === value);
const selectedRole = [...(roles || []), ...legacyRoles, ...legacyExcludedRoles].find(r => r.value === value);

const localizedOptions = (!shouldDisplayLegacyRoles ? roles : legacy_roles).map(role => ({
const localizedOptions = (!shouldDisplayLegacyRoles ? roles : legacyRoles).map(role => ({
value: role.value,
label: localizeCustomRole(role.value) || role.label,
}));
Expand Down
4 changes: 2 additions & 2 deletions packages/clerk-js/src/ui/hooks/useFetch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useLayoutEffect, useRef } from 'react';
import { useEffect, useRef } from 'react';

import { useLoadingStatus } from './useLoadingStatus';
import { useSafeState } from './useSafeState';
Expand All @@ -17,7 +17,7 @@ export const useFetch = <T>(

const fetcherRef = useRef(fetcher);

useLayoutEffect(() => {
useEffect(() => {
if (!fetcherRef.current) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ export interface PermissionJSON extends ClerkResourceJSON {
key: string;
name: string;
description: string;
type: 'system';
type: 'system' | 'user';
created_at: number;
updated_at: number;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface PermissionResource extends ClerkResource {
id: string;
key: string;
name: string;
type: 'system';
type: 'system' | 'user';
description: string;
createdAt: Date;
updatedAt: Date;
Expand Down

0 comments on commit ba188b6

Please sign in to comment.