Fetch the snippet content if it's empty.

This commit is contained in:
Ivan Vasilov committed 2024-12-16 17:37:32 +01:00
1 parent e053898592
commit 092d30d438
1 file changed
+3 -1
+3 -1
View File
@@ -39,7 +39,9 @@ const SqlEditor: NextPageWithLayout = () => {
// Don't fetch the snippet if it already exists in the state. This avoids a race condition where
// the snippet is inserted and fetched at the same time.
const existsSnippet = id ? !!snapV2.snippets[id] : undefined
const existsSnippet = id
? id in snapV2.snippets && snapV2.snippets[id].snippet?.content !== undefined
: undefined
useContentIdQuery(
{ projectRef: ref, id },