Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: group table and selectors showing only partial groups (#17187)

boojack0ce0edcd7405
diff --git a/frontend/src/AuthContext.vue b/frontend/src/AuthContext.vue
index ae40d12faf..2672eacb67 100644
--- a/frontend/src/AuthContext.vue
+++ b/frontend/src/AuthContext.vue
@@ -105,6 +105,9 @@ watch(
workspaceStore.fetchIamPolicy(),
roleStore.fetchRoleList(),
]);
+
+ // Only load groups that are referenced in IAM policy bindings
+ // Components that need ALL groups will call fetchGroupList() separately
const groups = getGroupList(policy);
await groupStore.batchFetchGroups(groups);
diff --git a/frontend/src/components/Member/MembersBindingSelect.vue b/frontend/src/components/Member/MembersBindingSelect.vue
index be5051d02d..bcf584c3c8 100644
--- a/frontend/src/components/Member/MembersBindingSelect.vue
+++ b/frontend/src/components/Member/MembersBindingSelect.vue
@@ -111,11 +111,15 @@ const memberType = ref<MemberType>("USERS");
const userStore = useUserStore();
const groupStore = useGroupStore();
-onMounted(() => {
+onMounted(async () => {
const isGroupType =
props.value.length > 0 &&
props.value.every((member) => member.startsWith(groupBindingPrefix));
memberType.value = isGroupType ? "GROUPS" : "USERS";
+
+ // This component needs ALL groups for selection when user switches to group mode
+ // AuthContext only loads groups that have IAM policy bindings via batchFetchGroups
+ await groupStore.fetchGroupList();
});
watchEffect(async () => {
diff --git a/frontend/src/components/User/Settings/UserDataTable/index.vue b/frontend/src/components/User/Settings/UserDataTable/index.vue
index f116bb585e..c08fae25d7 100644
--- a/frontend/src/components/User/Settings/UserDataTable/index.vue
+++ b/frontend/src/components/User/Settings/UserDataTable/index.vue
@@ -25,10 +25,15 @@ import { create } from "@bufbuild/protobuf";
import { FieldMaskSchema } from "@bufbuild/protobuf/wkt";
import type { DataTableColumn } from "naive-ui";
import { NDataTable } from "naive-ui";
-import { computed, reactive, h } from "vue";
+import { computed, reactive, h, onMounted } from "vue";
import { useI18n } from "vue-i18n";
import { BBAlert } from "@/bbkit";
-import { useUserStore, useWorkspaceV1Store, pushNotification } from "@/store";
+import {
+ useUserStore,
+ useWorkspaceV1Store,
+ useGroupStore,
+ pushNotification,
+} from "@/store";
import type { Group } from "@/types/proto-es/v1/group_service_pb";
import {
type User,
@@ -63,8 +68,15 @@ const emit = defineEmits<{
const { t } = useI18n();
const userStore = useUserStore();
+const groupStore = useGroupStore();
const workspaceStore = useWorkspaceV1Store();
+onMounted(async () => {
+ // Load all groups once for the entire table to avoid duplicate requests
+ // from individual GroupsCell components
+ await groupStore.fetchGroupList();
+});
+
const state = reactive<LocalState>({
showResetKeyAlert: false,
});
diff --git a/frontend/src/components/v2/Select/GroupSelect.vue b/frontend/src/components/v2/Select/GroupSelect.vue
index d3f8511197..997f94d70c 100644
--- a/frontend/src/components/v2/Select/GroupSelect.vue
+++ b/frontend/src/components/v2/Select/GroupSelect.vue
@@ -14,10 +14,15 @@
<script lang="tsx" setup>
import { computedAsync } from "@vueuse/core";
-import { computed } from "vue";
+import { computed, onMounted } from "vue";
import { getMemberBindings } from "@/components/Member/utils";
import GroupNameCell from "@/components/User/Settings/UserDataTableByGroup/cells/GroupNameCell.vue";
-import { useGroupList, useProjectV1Store, useWorkspaceV1Store } from "@/store";
+import {
+ useGroupList,
+ useGroupStore,
+ useProjectV1Store,
+ useWorkspaceV1Store,
+} from "@/store";
import { PRESET_WORKSPACE_ROLES } from "@/types";
import type { Group } from "@/types/proto-es/v1/group_service_pb";
import ResourceSelect from "./ResourceSelect.vue";
@@ -47,10 +52,17 @@ defineEmits<{
(event: "update:groups", val: string[]): void;
}>();
+const groupStore = useGroupStore();
const groupList = useGroupList();
const projectV1Store = useProjectV1Store();
const workspaceStore = useWorkspaceV1Store();
+onMounted(async () => {
+ // This component needs ALL groups for selection, not just those in IAM bindings
+ // AuthContext only loads groups that have IAM policy bindings via batchFetchGroups
+ await groupStore.fetchGroupList();
+});
+
const filteredGroupList = computedAsync(async () => {
if (!props.projectName) {
return groupList.value;
diff --git a/frontend/src/store/modules/v1/group.ts b/frontend/src/store/modules/v1/group.ts
index 18533bf90c..9b75a58350 100644
--- a/frontend/src/store/modules/v1/group.ts
+++ b/frontend/src/store/modules/v1/group.ts
@@ -27,6 +27,9 @@ const ensureGroupIdentifier = (id: string) => {
return `${groupNamePrefix}${email}`;
};
+// Two-tier loading strategy:
+// 1. AuthContext: batchFetchGroups() for IAM-referenced groups
+// 2. Specific components: fetchGroupList() for ALL groups when needed
export const useGroupStore = defineStore("group", () => {
const groupMapByName = reactive(new Map<string, Group>());
const resetCache = () => {
diff --git a/frontend/src/views/SettingWorkspaceUsers.vue b/frontend/src/views/SettingWorkspaceUsers.vue
index 4d199ede64..0335d4bd1d 100644
--- a/frontend/src/views/SettingWorkspaceUsers.vue
+++ b/frontend/src/views/SettingWorkspaceUsers.vue
@@ -205,6 +205,7 @@ import {
featureToRef,
useActuatorV1Store,
useGroupList,
+ useGroupStore,
useSettingV1Store,
useSubscriptionV1Store,
useUIStateStore,
@@ -252,6 +253,7 @@ const { t } = useI18n();
const route = useRoute();
const router = useRouter();
const userStore = useUserStore();
+const groupStore = useGroupStore();
const groupList = useGroupList();
const uiStateStore = useUIStateStore();
const actuatorStore = useActuatorV1Store();
@@ -346,7 +348,7 @@ const allowCreateUser = computed(() => {
return hasWorkspacePermissionV2("bb.users.create");
});
-onMounted(() => {
+onMounted(async () => {
if (!uiStateStore.getIntroStateByKey("member.visit")) {
uiStateStore.saveIntroStateByKey({
key: "member.visit",
@@ -354,6 +356,10 @@ onMounted(() => {
});
}
+ // This page needs ALL groups for the group table and group selectors
+ // AuthContext only loads groups that are in IAM policy bindings
+ await groupStore.fetchGroupList();
+
const name = route.query.name as string;
if (name?.startsWith(groupNamePrefix)) {
state.typeTab = "GROUPS";