Skip to content

Commit ab22b2d

Browse files
committed
Fix: remove shouldLoad from useEffect deps and simplify consent callback
1 parent 9ba5562 commit ab22b2d

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

apps/web-roo-code/src/components/providers/google-analytics-provider.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,12 @@ export function GoogleAnalyticsProvider({ children }: { children: React.ReactNod
2222

2323
// Listen for consent changes
2424
const unsubscribe = onConsentChange((consented) => {
25-
if (consented && !shouldLoad) {
25+
if (consented) {
2626
setShouldLoad(true)
2727
}
2828
})
2929

3030
return unsubscribe
31-
}, [shouldLoad])
32-
33-
useEffect(() => {
34-
// Initialize dataLayer as early as possible (Google's recommended pattern)
35-
if (typeof window !== "undefined") {
36-
window.dataLayer = window.dataLayer || []
37-
}
3831
}, [])
3932

4033
return (

0 commit comments

Comments
 (0)