The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix: use-isomorphic-layout-effect (#29762)
Alaister Youngb04dbf98762e
diff --git a/apps/studio/hooks/misc/useSynchronizedAnimation.ts b/apps/studio/hooks/misc/useSynchronizedAnimation.tsindex 90258ed0c85..756a3ba62af 100644--- a/apps/studio/hooks/misc/useSynchronizedAnimation.ts+++ b/apps/studio/hooks/misc/useSynchronizedAnimation.ts@@ -1,4 +1,5 @@-import { useLayoutEffect, useRef } from 'react'+import { useIsomorphicLayoutEffect } from 'common'+import { useRef } from 'react'// Source: https://youtu.be/3kDVachh-BM@@ -7,7 +8,7 @@ let stashedTime: number | null = nullexport function useSynchronizedAnimation<T>(name: string) {const ref = useRef<T>(null)- useLayoutEffect(() => {+ useIsomorphicLayoutEffect(() => {const animations = document.getAnimations().filter(diff --git a/packages/common/hooks/index.ts b/packages/common/hooks/index.tsindex b94155dac83..7953fdbf4e3 100644--- a/packages/common/hooks/index.ts+++ b/packages/common/hooks/index.ts@@ -4,6 +4,7 @@ export * from './useCopy'export * from './useDebounce'export * from './useDocsSearch'export * from './useDragToClose'+export * from './useIsomorphicLayoutEffect'export * from './useParams'export * from './useSearchParamsShallow'export * from './useTelemetryProps'diff --git a/packages/common/hooks/useIsomorphicLayoutEffect.tsx b/packages/common/hooks/useIsomorphicLayoutEffect.tsxnew file mode 100644index 00000000000..39a66ae0b8f--- /dev/null+++ b/packages/common/hooks/useIsomorphicLayoutEffect.tsx@@ -0,0 +1,4 @@+import { useEffect, useLayoutEffect } from 'react'++export const useIsomorphicLayoutEffect =+ typeof document !== 'undefined' ? useLayoutEffect : useEffect