mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
test reverting something
This commit is contained in:
@@ -192,14 +192,31 @@ export function InsightsProvider(props: InsightsProviderProps) {
|
||||
React.useEffect(() => {
|
||||
getVisitorId().then((visitorId) => {
|
||||
visitorIdRef.current = visitorId;
|
||||
// When the page is unloaded, flush all events, but only if the visitor ID is set
|
||||
window.addEventListener('beforeunload', flushEventsSync);
|
||||
});
|
||||
}, []);
|
||||
|
||||
// When the page is unloaded, flush all events
|
||||
React.useEffect(() => {
|
||||
window.addEventListener('beforeunload', flushEventsSync);
|
||||
return () => {
|
||||
window.removeEventListener('beforeunload', flushEventsSync);
|
||||
};
|
||||
}, [flushEventsSync]);
|
||||
|
||||
/**
|
||||
* Get the visitor ID and store it in a ref.
|
||||
*/
|
||||
// React.useEffect(() => {
|
||||
// getVisitorId().then((visitorId) => {
|
||||
// visitorIdRef.current = visitorId;
|
||||
// // When the page is unloaded, flush all events, but only if the visitor ID is set
|
||||
// window.addEventListener('beforeunload', flushEventsSync);
|
||||
// });
|
||||
// return () => {
|
||||
// window.removeEventListener('beforeunload', flushEventsSync);
|
||||
// };
|
||||
// }, [flushEventsSync]);
|
||||
|
||||
return (
|
||||
<InsightsContext.Provider value={trackEvent}>
|
||||
<OpenAPIOperationContextProvider
|
||||
|
||||
Reference in New Issue
Block a user