@@ -14,21 +14,23 @@ export const appHostedSegment = "app-hosted-v1";
1414// something will presumably notice the difference.
1515export function useIsAppHosted ( ) {
1616 // Note: While the SPA is changing the history state, an intermediate URL is "/#!/app-hosted-[...]".
17- // The path is technically "/", not "/app-hosted", but we want to detect that as app-hosted too.
17+ // The path is technically "/", not "/app-hosted-[...] ", but we want to detect that as app-hosted too.
1818 // (Probably not too likely to happen in this hook version)
1919 const location = useLocation ( ) ;
2020 return (
2121 location . pathname . startsWith ( "/app-hosted-" ) ||
22- location . pathname . startsWith ( "/#!/app-hosted-" )
22+ ( location . pathname === "/" &&
23+ location . hash . startsWith ( "#!/app-hosted-" ) )
2324 ) ;
2425}
2526export function isAppHosted ( ) {
2627 // Note: While the SPA is changing the history state, an intermediate URL is "/#!/app-hosted-[...]".
27- // The path is technically "/", not "/app-hosted", but we want to detect that as app-hosted too.
28+ // The path is technically "/", not "/app-hosted-[...] ", but we want to detect that as app-hosted too.
2829 // This is a very real possibility for context providers like OSFeaturesContext.
2930 return (
3031 window . location . pathname . startsWith ( "/app-hosted-" ) ||
31- window . location . pathname . startsWith ( "/#!/app-hosted-" )
32+ ( window . location . pathname === "/" &&
33+ window . location . hash . startsWith ( "#!/app-hosted-" ) )
3234 ) ;
3335}
3436
0 commit comments