MCPcopy Create free account
hub / github.com/dailydotdev/apps / onRouteChange

Function onRouteChange

packages/shared/src/hooks/useAppStoreReviewPrompt.ts:80–108  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

78 wasOnPost.current = isPostUrl(asPathRef.current ?? '');
79
80 const onRouteChange = (url: string) => {
81 const onPost = isPostUrl(url);
82 const leftPost = wasOnPost.current && !onPost;
83 wasOnPost.current = onPost;
84
85 if (
86 !leftPost ||
87 hasAsked.current ||
88 modalRef.current ||
89 isPausedRef.current ||
90 !marketingCtaRef.current
91 ) {
92 return;
93 }
94
95 hasAsked.current = true;
96 const { current } = marketingCtaRef;
97 if (current.variant === MarketingCtaVariant.AppStoreReviewPlus) {
98 openModal({
99 type: LazyModal.AppStoreReviewPlus,
100 props: { marketingCta: current },
101 });
102 return;
103 }
104 openModal({
105 type: LazyModal.AppStoreReview,
106 props: { marketingCta: current },
107 });
108 };
109
110 events.on('routeChangeComplete', onRouteChange);
111

Callers

nothing calls this directly

Calls 2

isPostUrlFunction · 0.85
openModalFunction · 0.85

Tested by

no test coverage detected