File tree Expand file tree Collapse file tree 2 files changed +25
-21
lines changed
packages/ui-patterns/ConsentToast Expand file tree Collapse file tree 2 files changed +25
-21
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments