The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
fix hydration error on promotoast (#19283)
Charis4c39abd88a14
diff --git a/packages/ui/src/components/PromoToast/PromoToast.tsx b/packages/ui/src/components/PromoToast/PromoToast.tsxindex 62db37c023f..17dde8ef60a 100644--- a/packages/ui/src/components/PromoToast/PromoToast.tsx+++ b/packages/ui/src/components/PromoToast/PromoToast.tsx@@ -1,25 +1,29 @@-import { isBrowser } from 'common'import Image from 'next/image'import Link from 'next/link'-import { useState } from 'react'+import { useEffect, useState } from 'react'import { Button } from 'ui'import announcement from '../../layout/banners/data/Announcement.json'import CountdownComponent from '../CountdownWidget/Countdown'import PromoBg from './PromoBg'const PromoToast = () => {- const [visible, setVisible] = useState(true)+ const [visible, setVisible] = useState(false)const LWXLogo ='https://obuldanrptloktxcffvn.supabase.co/storage/v1/object/public/images/lwx/assets/lwx_logo.svg?t=2023-11-22T17%3A45%3A52.077Z'- if (!isBrowser) return null+ useEffect(() => {+ const shouldHide = localStorage?.getItem('supabase-hide-promo-toast') === 'true'+ if (!shouldHide) {+ setVisible(true)+ }+ }, [])+const handleHide = () => {setVisible(false)localStorage?.setItem('supabase-hide-promo-toast', 'true')}- const shouldShowToast = isBrowser && localStorage?.getItem('supabase-hide-promo-toast') !== 'true'- if (!visible || !shouldShowToast) {+ if (!visible) {return null}