Fix query block read only catch (#35543)

* Fix query block read only catch

* Update apps/studio/components/ui/QueryBlock/QueryBlock.tsx

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>

---------

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
This commit is contained in:
Joshen LimandAlaister Young authored and GitHub committed 2025-05-08 15:35:08 +08:00
1 parent fe60571754
commit ff3832a659
1 file changed
+6 -1
@@ -167,9 +167,14 @@ export const QueryBlock = ({
onSuccess: (data) => {
onResults?.(data.result)
setQueryResult(data.result)
setReadOnlyError(false)
setQueryError(undefined)
},
onError: (error) => {
if (error?.message.includes('permission denied')) {
const permissionDenied = error.message.includes('permission denied')
const notOwner = error.message.includes('must be owner')
if (permissionDenied || notOwner) {
setReadOnlyError(true)
if (showRunButtonIfNotReadOnly) setShowWarning('hasWriteOperation')
} else {