|
|
@@ -82,7 +82,6 @@ function createGlobalSync() {
|
|
|
})
|
|
|
|
|
|
const children: Record<string, ReturnType<typeof createStore<State>>> = {}
|
|
|
- const permissionListeners: Set<(info: { directory: string; permission: Permission }) => void> = new Set()
|
|
|
function child(directory: string) {
|
|
|
if (!directory) console.error("No directory provided")
|
|
|
if (!children[directory]) {
|
|
|
@@ -330,7 +329,6 @@ function createGlobalSync() {
|
|
|
}
|
|
|
case "permission.updated": {
|
|
|
const permissions = store.permission[event.properties.sessionID]
|
|
|
- const isNew = !permissions || !permissions.find((p) => p.id === event.properties.id)
|
|
|
if (!permissions) {
|
|
|
setStore("permission", event.properties.sessionID, [event.properties])
|
|
|
} else {
|
|
|
@@ -347,11 +345,6 @@ function createGlobalSync() {
|
|
|
}),
|
|
|
)
|
|
|
}
|
|
|
- if (isNew) {
|
|
|
- for (const listener of permissionListeners) {
|
|
|
- listener({ directory, permission: event.properties })
|
|
|
- }
|
|
|
- }
|
|
|
break
|
|
|
}
|
|
|
case "permission.replied": {
|
|
|
@@ -439,12 +432,6 @@ function createGlobalSync() {
|
|
|
project: {
|
|
|
loadSessions,
|
|
|
},
|
|
|
- permission: {
|
|
|
- onUpdated(listener: (info: { directory: string; permission: Permission }) => void) {
|
|
|
- permissionListeners.add(listener)
|
|
|
- return () => permissionListeners.delete(listener)
|
|
|
- },
|
|
|
- },
|
|
|
}
|
|
|
}
|
|
|
|