fix: address code review issues in granular project access

- listProjects in members page load now uses .catch(() => null) so a
  permissions or network error does not break the entire page
- projectAccessSelector disables "Add project" when projects list is
  empty (prevents unusable required dropdown row)
- createMember resets orgProjects on modal close so subsequent opens
  fetch a fresh list instead of showing a stale one
- edit modal init effect now checks supportsProjectRoles before setting
  accessType to 'specific', preventing a silent role re-submission when
  the org plan is downgraded below the project-roles threshold
This commit is contained in:
harsh mahajan
2026-05-28 19:59:59 +05:30
parent 8614a62750
commit 145e48ea16
4 changed files with 4 additions and 3 deletions
@@ -58,6 +58,7 @@
role = isSelfHosted ? 'owner' : 'developer';
accessType = 'all';
projectAccess = [];
orgProjects = [];
}
});
@@ -21,7 +21,7 @@ export const load: PageLoad = async ({ url, params, route, depends }) => {
}),
sdk.forConsole.organization(params.organization).listProjects({
queries: [Query.limit(100), Query.equal('teamId', params.organization)]
})
}).catch(() => null)
]);
return {
@@ -44,7 +44,7 @@
$effect(() => {
if (showEdit && selectedMember) {
const memberRoles = selectedMember.roles ?? [];
if (memberRoles.some(isProjectSpecificRole)) {
if (supportsProjectRoles && memberRoles.some(isProjectSpecificRole)) {
accessType = 'specific';
projectAccess = memberRoles.filter(isProjectSpecificRole).map((r) => {
const parsed = parseProjectRole(r);
@@ -25,7 +25,7 @@
.map((p) => ({ label: p.name, value: p.$id }));
}
const allSelected = $derived(projects.length > 0 && projectAccess.length >= projects.length);
const allSelected = $derived(projects.length === 0 || projectAccess.length >= projects.length);
function addRow() {
projectAccess = [...projectAccess, { projectId: '', roleName: 'developer' }];