Skip to content

Commit 70affdc

Browse files
committed
perf(package-maintainers): use shallowRef instead deep ref
1 parent 17640fe commit 70affdc

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

app/components/PackageMaintainers.vue

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ const {
1515
listTeamUsers,
1616
} = useConnector()
1717
18-
const showAddOwner = ref(false)
19-
const newOwnerUsername = ref('')
20-
const isAdding = ref(false)
18+
const showAddOwner = shallowRef(false)
19+
const newOwnerUsername = shallowRef('')
20+
const isAdding = shallowRef(false)
2121
2222
// Show admin controls when connected (let npm CLI handle permission errors)
2323
const canManageOwners = computed(() => isConnected.value)
@@ -30,9 +30,9 @@ const orgName = computed(() => {
3030
})
3131
3232
// Access data: who has access and via what
33-
const collaborators = ref<Record<string, 'read-only' | 'read-write'>>({})
33+
const collaborators = shallowRef<Record<string, 'read-only' | 'read-write'>>({})
3434
const teamMembers = ref<Record<string, string[]>>({}) // team -> members
35-
const isLoadingAccess = ref(false)
35+
const isLoadingAccess = shallowRef(false)
3636
3737
// Compute access source for each maintainer
3838
const maintainerAccess = computed(() => {
@@ -142,21 +142,14 @@ async function handleRemoveOwner(username: string) {
142142
143143
// Load access info when connected and for scoped packages
144144
watch(
145-
[isConnected, () => props.packageName],
145+
[isConnected, () => props.packageName, lastExecutionTime],
146146
([connected]) => {
147147
if (connected && orgName.value) {
148148
loadAccessInfo()
149149
}
150150
},
151151
{ immediate: true },
152152
)
153-
154-
// Refresh data when operations complete
155-
watch(lastExecutionTime, () => {
156-
if (isConnected.value && orgName.value) {
157-
loadAccessInfo()
158-
}
159-
})
160153
</script>
161154

162155
<template>

0 commit comments

Comments
 (0)