Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Add guard in createBucket within StorageExplorerStore

Joshen Lim52fa1a4e97c3
diff --git a/studio/localStores/storageExplorer/StorageExplorerStore.js b/studio/localStores/storageExplorer/StorageExplorerStore.js
index f9790478a1b..cb5a793c31a 100644
--- a/studio/localStores/storageExplorer/StorageExplorerStore.js
+++ b/studio/localStores/storageExplorer/StorageExplorerStore.js
@@ -6,8 +6,9 @@ import {
compact,
isEqual,
isNull,
- has,
+ isNil,
isUndefined,
+ has,
some,
chunk,
get,
@@ -376,11 +377,15 @@ class StorageExplorerStore {
/* Bucket CRUD */
createBucket = async (bucketName, isPublic = false) => {
+ if (isNil(this.supabaseClient)) {
+ return toast.error('Failed to initialize supabase client, try refreshing your browser.')
+ }
+
const { error } = await this.supabaseClient.storage.createBucket(bucketName, {
public: isPublic,
})
if (error) {
- toast(error.message)
+ toast.error(error.message)
return this.closeCreateBucketModal()
}