From 52fa1a4e97c394189550e37094397c4663c382fc Mon Sep 17 00:00:00 2001 From: Joshen Lim Date: Mon, 13 Dec 2021 14:40:23 +0700 Subject: [PATCH] Add guard in createBucket within StorageExplorerStore --- .../localStores/storageExplorer/StorageExplorerStore.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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() }