Skip to content

Commit 85dde8f

Browse files
authored
fix(studio): use older supported syntax rather than Map.groupBy (supabase#41284)
Some users' browsers do not support Map.groupBy (used in Storage.utils.ts)
1 parent c0c8248 commit 85dde8f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

apps/studio/components/interfaces/Storage/Storage.utils.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,13 @@ export const extractBucketNameFromDefinition = (definition: string | null) => {
9090
}
9191

9292
const groupPoliciesByBucket = (policies: (PostgresPolicy & { bucket: string | Symbol })[]) => {
93-
const policiesByBucket = Map.groupBy(policies, (policy) => policy.bucket)
93+
const policiesByBucket = new Map<string | Symbol, PostgresPolicy[]>()
94+
policies.forEach((policy) => {
95+
if (!policiesByBucket.has(policy.bucket)) {
96+
policiesByBucket.set(policy.bucket, [])
97+
}
98+
policiesByBucket.get(policy.bucket)?.push(policy)
99+
})
94100
return [
95101
...policiesByBucket.entries().map(([bucketName, policies]) => ({ name: bucketName, policies })),
96102
]

0 commit comments

Comments
 (0)