Merged in fix/SW-2375-aa-tracking-critical-pageview- (pull request #1863)
fix: SW-2375 Fixed object comparison in bookingflow params flag * fix: SW-2375 Fixed object comparison in bookingflow params flag Approved-by: Niclas Edenvin
This commit is contained in:
@@ -18,14 +18,14 @@ export default function RouterTracking() {
|
|||||||
setInitialPageLoadTime,
|
setInitialPageLoadTime,
|
||||||
updateRouteInfo,
|
updateRouteInfo,
|
||||||
hasPathOrLangChanged,
|
hasPathOrLangChanged,
|
||||||
hasBookingFlowParamsChange,
|
hasBookingFlowParamsChanged,
|
||||||
} = useTrackingStore()
|
} = useTrackingStore()
|
||||||
|
|
||||||
const { startRouterTransition } = useRouterTransitionStore()
|
const { startRouterTransition } = useRouterTransitionStore()
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
updateRouteInfo(pathName, currentLang, searchParams)
|
updateRouteInfo(pathName, currentLang, searchParams)
|
||||||
if (hasPathOrLangChanged() || hasBookingFlowParamsChange()) {
|
if (hasPathOrLangChanged() || hasBookingFlowParamsChanged()) {
|
||||||
setInitialPageLoadTime(Date.now())
|
setInitialPageLoadTime(Date.now())
|
||||||
trackPageViewStart()
|
trackPageViewStart()
|
||||||
startTransition(() => {
|
startTransition(() => {
|
||||||
@@ -38,7 +38,7 @@ export default function RouterTracking() {
|
|||||||
currentLang,
|
currentLang,
|
||||||
updateRouteInfo,
|
updateRouteInfo,
|
||||||
hasPathOrLangChanged,
|
hasPathOrLangChanged,
|
||||||
hasBookingFlowParamsChange,
|
hasBookingFlowParamsChanged,
|
||||||
setInitialPageLoadTime,
|
setInitialPageLoadTime,
|
||||||
startRouterTransition,
|
startRouterTransition,
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ interface TrackingStoreState {
|
|||||||
params: ReadonlyURLSearchParams
|
params: ReadonlyURLSearchParams
|
||||||
) => void
|
) => void
|
||||||
hasPathOrLangChanged: () => boolean
|
hasPathOrLangChanged: () => boolean
|
||||||
hasBookingFlowParamsChange: () => boolean
|
hasBookingFlowParamsChanged: () => boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
const useTrackingStore = create<TrackingStoreState>((set, get) => ({
|
const useTrackingStore = create<TrackingStoreState>((set, get) => ({
|
||||||
@@ -69,7 +69,7 @@ const useTrackingStore = create<TrackingStoreState>((set, get) => ({
|
|||||||
|
|
||||||
return currentPath !== previousPath || currentLang !== previousLang
|
return currentPath !== previousPath || currentLang !== previousLang
|
||||||
},
|
},
|
||||||
hasBookingFlowParamsChange: () => {
|
hasBookingFlowParamsChanged: () => {
|
||||||
const { currentPath, currentParams, previousParams } = get()
|
const { currentPath, currentParams, previousParams } = get()
|
||||||
|
|
||||||
if (!previousParams || !currentParams) return false
|
if (!previousParams || !currentParams) return false
|
||||||
@@ -84,7 +84,7 @@ const useTrackingStore = create<TrackingStoreState>((set, get) => ({
|
|||||||
searchParamsToRecord(currentParams)
|
searchParamsToRecord(currentParams)
|
||||||
)
|
)
|
||||||
|
|
||||||
return Object.is(previousParamsObject, currentParamsObject)
|
return !Object.is(previousParamsObject, currentParamsObject)
|
||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user