Skip to content

Commit 9bd0882

Browse files
committed
perf(package-access-controls): use shallowRef instead deep ref
1 parent 14bd054 commit 9bd0882

1 file changed

Lines changed: 12 additions & 31 deletions

File tree

app/components/PackageAccessControls.vue

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ const orgName = computed(() => {
2323
})
2424
2525
// Data
26-
const collaborators = ref<Record<string, 'read-only' | 'read-write'>>({})
27-
const teams = ref<string[]>([])
28-
const isLoadingCollaborators = ref(false)
29-
const isLoadingTeams = ref(false)
30-
const error = ref<string | null>(null)
26+
const collaborators = shallowRef<Record<string, 'read-only' | 'read-write'>>({})
27+
const teams = shallowRef<string[]>([])
28+
const isLoadingCollaborators = shallowRef(false)
29+
const isLoadingTeams = shallowRef(false)
30+
const error = shallowRef<string | null>(null)
3131
3232
// Grant access form
33-
const showGrantAccess = ref(false)
34-
const selectedTeam = ref('')
35-
const permission = ref<'read-only' | 'read-write'>('read-only')
36-
const isGranting = ref(false)
33+
const showGrantAccess = shallowRef(false)
34+
const selectedTeam = shallowRef('')
35+
const permission = shallowRef<'read-only' | 'read-write'>('read-only')
36+
const isGranting = shallowRef(false)
3737
3838
// Computed collaborator list with type detection
3939
const collaboratorList = computed(() => {
@@ -136,36 +136,17 @@ async function handleRevokeAccess(collaboratorName: string) {
136136
await addOperation(operation)
137137
}
138138
139-
// Load on mount when connected
139+
// Reload when package changes
140140
watch(
141-
isConnected,
142-
connected => {
141+
() => [isConnected.value, props.packageName, lastExecutionTime.value],
142+
([connected]) => {
143143
if (connected && orgName.value) {
144144
loadCollaborators()
145145
loadTeams()
146146
}
147147
},
148148
{ immediate: true },
149149
)
150-
151-
// Reload when package changes
152-
watch(
153-
() => props.packageName,
154-
() => {
155-
if (isConnected.value && orgName.value) {
156-
loadCollaborators()
157-
loadTeams()
158-
}
159-
},
160-
)
161-
162-
// Refresh data when operations complete
163-
watch(lastExecutionTime, () => {
164-
if (isConnected.value && orgName.value) {
165-
loadCollaborators()
166-
loadTeams()
167-
}
168-
})
169150
</script>
170151

171152
<template>

0 commit comments

Comments
 (0)