Skip to content

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

fix(sql-editor): revert lazy loading framer motion due to runtime errors

Greg Richardsonf6abc4012b74
diff --git a/package-lock.json b/package-lock.json
index e285bd330c1..143b1ce500d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -21884,7 +21884,8 @@
},
"node_modules/framer-motion": {
"version": "6.5.1",
- "license": "MIT",
+ "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-6.5.1.tgz",
+ "integrity": "sha512-o1BGqqposwi7cgDrtg0dNONhkmPsUFDaLcKXigzuTFC5x58mE8iyTazxSudFzmT6MEyJKfjjU8ItoMe3W+3fiw==",
"dependencies": {
"@motionone/dom": "10.12.0",
"framesync": "6.0.1",
diff --git a/studio/components/interfaces/SQLEditor/SQLEditor.tsx b/studio/components/interfaces/SQLEditor/SQLEditor.tsx
index add648900ca..dd0fe1a6daa 100644
--- a/studio/components/interfaces/SQLEditor/SQLEditor.tsx
+++ b/studio/components/interfaces/SQLEditor/SQLEditor.tsx
@@ -4,7 +4,7 @@ import { useSqlEditMutation } from 'data/ai/sql-edit-mutation'
import { useSqlTitleGenerateMutation } from 'data/ai/sql-title-mutation'
import { useEntityDefinitionsQuery } from 'data/database/entity-definitions-query'
import { useExecuteSqlMutation } from 'data/sql/execute-sql-mutation'
-import { AnimatePresence, m } from 'framer-motion'
+import { AnimatePresence, motion } from 'framer-motion'
import {
useLocalStorage,
useLocalStorageQuery,
@@ -243,7 +243,7 @@ const SQLEditor = () => {
>
<AISettingsModal visible={isAISettingsOpen} onCancel={() => setIsAISettingsOpen(false)} />
<div className="flex h-full flex-col">
- <m.div
+ <motion.div
key="ask-ai-input-container"
layoutId="ask-ai-input-container"
variants={{
@@ -257,7 +257,7 @@ const SQLEditor = () => {
>
<AnimatePresence initial={false} exitBeforeEnter>
{!isEditSqlLoading ? (
- <m.div
+ <motion.div
key="ask-ai-input"
className="w-full"
variants={{
@@ -286,9 +286,9 @@ const SQLEditor = () => {
inputRef={inputRef}
icon={
<div className="h-full flex flex-row gap-3 items-center">
- <m.div layoutId="ask-ai-input-icon" className="ml-1">
+ <motion.div layoutId="ask-ai-input-icon" className="ml-1">
<AiIcon className="w-4 h-4" />
- </m.div>
+ </motion.div>
{debugSolution && (
<div className="h-full w-full flex flex-row items-center overflow-y-hidden mr-[16.5rem] text-sm text-white">
@@ -393,9 +393,9 @@ const SQLEditor = () => {
}
}}
/>
- </m.div>
+ </motion.div>
) : (
- <m.div
+ <motion.div
key="ask-ai-loading"
className="p-4 flex flex-row gap-2 items-center w-full"
variants={{
@@ -415,7 +415,7 @@ const SQLEditor = () => {
animate="visible"
exit="hidden"
>
- <m.div
+ <motion.div
className="text-brand-900"
animate={{
scale: [0.9, 1.1, 0.9],
@@ -427,8 +427,8 @@ const SQLEditor = () => {
}}
>
<AiIcon className="w-4 h-4" />
- </m.div>
- <m.span
+ </motion.div>
+ <motion.span
animate={{
opacity: ['0.5', '0.75', '0.5'],
transition: {
@@ -439,11 +439,11 @@ const SQLEditor = () => {
}}
>
Thinking...
- </m.span>
- </m.div>
+ </motion.span>
+ </motion.div>
)}
</AnimatePresence>
- </m.div>
+ </motion.div>
<Split
style={{ height: '100%' }}
direction="vertical"
@@ -463,7 +463,7 @@ const SQLEditor = () => {
) : (
<>
{isDiffOpen && (
- <m.div
+ <motion.div
className="w-full h-full"
variants={{
visible: {
@@ -487,9 +487,9 @@ const SQLEditor = () => {
fontSize: 13,
}}
/>
- </m.div>
+ </motion.div>
)}
- <m.div
+ <motion.div
key={id}
variants={{
visible: {
@@ -512,7 +512,7 @@ const SQLEditor = () => {
autoFocus={false}
executeQuery={executeQuery}
/>
- </m.div>
+ </motion.div>
</>
)}
</div>
diff --git a/studio/components/interfaces/SQLEditor/SQLTemplates/SQLTemplates.tsx b/studio/components/interfaces/SQLEditor/SQLTemplates/SQLTemplates.tsx
index d4a1e920b8e..8472cd20c60 100644
--- a/studio/components/interfaces/SQLEditor/SQLTemplates/SQLTemplates.tsx
+++ b/studio/components/interfaces/SQLEditor/SQLTemplates/SQLTemplates.tsx
@@ -10,7 +10,7 @@ import {
import { useSqlGenerateMutation } from 'data/ai/sql-generate-mutation'
import { SqlSnippet } from 'data/content/sql-snippets-query'
import { useEntityDefinitionsQuery } from 'data/database/entity-definitions-query'
-import { m } from 'framer-motion'
+import { motion } from 'framer-motion'
import {
useCheckPermissions,
useLocalStorageQuery,
@@ -92,7 +92,7 @@ const SQLTemplates = observer(() => {
<AISettingsModal visible={isAISettingsOpen} onCancel={() => setIsAISettingsOpen(false)} />
<div className="block h-full space-y-8 overflow-y-auto p-6">
<div className="mt-32 mb-32 flex flex-col items-center">
- <m.h1
+ <motion.h1
className="text-scale-1200 mb-8 text-3xl"
variants={{
visible: {
@@ -108,10 +108,10 @@ const SQLTemplates = observer(() => {
animate="visible"
>
What do you want to build?
- </m.h1>
+ </motion.h1>
<div className="w-full flex justify-center">
{!isSqlGenerateLoading ? (
- <m.div
+ <motion.div
key="ask-ai-input-container"
layoutId="ask-ai-input-container"
className="w-full max-w-2xl border border-brand-900"
@@ -138,7 +138,7 @@ const SQLTemplates = observer(() => {
}, 200)
}}
icon={
- <m.div
+ <motion.div
key="ask-ai-input-icon"
layoutId="ask-ai-input-icon"
className="ml-1"
@@ -151,7 +151,7 @@ const SQLTemplates = observer(() => {
animate="visible"
>
<AiIcon className="w-4 h-4" />
- </m.div>
+ </motion.div>
}
inputClassName="w-full border-none py-4 focus:!ring-0 pr-20"
iconContainerClassName="transition text-scale-800 text-brand-900"
@@ -205,9 +205,9 @@ const SQLTemplates = observer(() => {
</div>
}
/>
- </m.div>
+ </motion.div>
) : (
- <m.div
+ <motion.div
key="ask-ai-loading"
layoutId="ask-ai-input-container"
className="p-5 border border-brand-900 text-brand-900"
@@ -225,7 +225,7 @@ const SQLTemplates = observer(() => {
initial="visible"
animate="visible"
>
- <m.div
+ <motion.div
key="ask-ai-loading-icon"
layoutId="ask-ai-input-icon"
animate={{
@@ -239,8 +239,8 @@ const SQLTemplates = observer(() => {
}}
>
<AiIcon className="w-4 h-4" />
- </m.div>
- </m.div>
+ </motion.div>
+ </motion.div>
)}
</div>
</div>
diff --git a/studio/motion-features.ts b/studio/motion-features.ts
deleted file mode 100644
index 1c8f87e9fe2..00000000000
--- a/studio/motion-features.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-import { domMax } from 'framer-motion'
-export default domMax
diff --git a/studio/pages/_app.tsx b/studio/pages/_app.tsx
index c3a8feaaf62..6051ab68387 100644
--- a/studio/pages/_app.tsx
+++ b/studio/pages/_app.tsx
@@ -54,9 +54,6 @@ import Favicons from 'components/head/Favicons'
import { IS_PLATFORM } from 'lib/constants'
import { SessionContextProvider } from '@supabase/auth-helpers-react'
import { createClient } from '@supabase/supabase-js'
-import { LazyMotion } from 'framer-motion'
-
-const motionFeatures = () => import('../motion-features').then((res) => res.default)
dayjs.extend(customParseFormat)
dayjs.extend(utc)
@@ -146,9 +143,7 @@ function CustomApp({ Component, pageProps }: AppPropsWithLayout) {
<ThemeProvider>
<CommandMenuWrapper>
<AppBannerWrapper>
- <LazyMotion features={motionFeatures} strict>
- {getLayout(<Component {...pageProps} />)}
- </LazyMotion>
+ {getLayout(<Component {...pageProps} />)}
</AppBannerWrapper>
</CommandMenuWrapper>
</ThemeProvider>