Skip to content

Commit d05b4bc

Browse files
fix consent toast first hover (supabase#28660)
* fix consent toast first hover * more delay * delay consent toast in studio
1 parent 4e09ea3 commit d05b4bc

File tree

2 files changed

+25
-21
lines changed

2 files changed

+25
-21
lines changed

apps/studio/pages/_app.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,16 @@ function CustomApp({ Component, pageProps }: AppPropsWithLayout) {
134134

135135
const hasAcknowledgedConsent = localStorage.getItem(LOCAL_STORAGE_KEYS.TELEMETRY_CONSENT)
136136
if (IS_PLATFORM && hasAcknowledgedConsent === null) {
137-
consentToastId.current = toast(
138-
<ConsentToast onAccept={onAcceptConsent} onOptOut={onOptOut} />,
139-
{
140-
id: 'consent-toast',
141-
position: 'bottom-right',
142-
duration: Infinity,
143-
}
144-
)
137+
setTimeout(() => {
138+
consentToastId.current = toast(
139+
<ConsentToast onAccept={onAcceptConsent} onOptOut={onOptOut} />,
140+
{
141+
id: 'consent-toast',
142+
position: 'bottom-right',
143+
duration: Infinity,
144+
}
145+
)
146+
}, 300)
145147
}
146148
}
147149
// eslint-disable-next-line react-hooks/exhaustive-deps

packages/ui-patterns/ConsentToast/index.tsx

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,21 @@ export const useConsent = () => {
9595

9696
useEffect(() => {
9797
if (isClient && consentValue === null) {
98-
consentToastId.current = toast(
99-
<ConsentToast
100-
onAccept={() => handleConsent('true')}
101-
onOptOut={() => handleConsent('false')}
102-
/>,
103-
{
104-
id: 'consent-toast',
105-
position: 'bottom-right',
106-
duration: Infinity,
107-
className:
108-
'!w-screen !-m-4 !border-t !rounded-none !max-w-none !bg-overlay !text sm:!m-0 sm:!rounded-lg sm:!w-auto sm:!max-w-[400px] sm:border',
109-
}
110-
)
98+
setTimeout(() => {
99+
consentToastId.current = toast(
100+
<ConsentToast
101+
onAccept={() => handleConsent('true')}
102+
onOptOut={() => handleConsent('false')}
103+
/>,
104+
{
105+
id: 'consent-toast',
106+
position: 'bottom-right',
107+
duration: Infinity,
108+
className:
109+
'!w-screen !-m-4 !border-t !rounded-none !max-w-none !bg-overlay !text sm:!m-0 sm:!rounded-lg sm:!w-auto sm:!max-w-[400px] sm:border',
110+
}
111+
)
112+
}, 300)
111113
}
112114
}, [consentValue])
113115

0 commit comments

Comments
 (0)