Skip to content

Commit

Permalink
fix: use getENV instead of server side context to check IS_MOBILE (#1…
Browse files Browse the repository at this point in the history
…4878)

fix: use getENV instead of server side context to check IS_MOBILE
  • Loading branch information
artsy-peril[bot] authored Nov 21, 2024
2 parents b6717c2 + 6b537d0 commit 3036572
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Apps/Artwork/artworkRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import loadable from "@loadable/component"
import { graphql } from "react-relay"
import { updateContext } from "Server/middleware/bootstrapSharifyAndContextLocalsMiddleware"
import { RouteProps } from "System/Router/Route"
import { getENV } from "Utils/getENV"

const ArtworkApp = loadable(
() => import(/* webpackChunkName: "artworkBundle" */ "./ArtworkApp"),
Expand All @@ -18,9 +19,9 @@ export const artworkRoutes: RouteProps[] = [
onClientSideRender: () => {
ArtworkApp.preload()
},
prepareVariables: ({ artworkID }, { context }) => {
prepareVariables: ({ artworkID }) => {
// We want to defer loading the sidebar for mobile as it is below-the-fold.
const loadSidebar = !context?.isMobile
const loadSidebar = !getENV("IS_MOBILE")

return {
artworkID,
Expand Down
1 change: 0 additions & 1 deletion src/System/Router/Utils/serverAppContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const getServerAppContext = (
initialMatchingMediaQueries: res.locals.sd.IS_MOBILE ? ["xs"] : undefined,
user: req.user,
isEigen: req.header("User-Agent")?.match("Artsy-Mobile") != null,
isMobile: res.locals.sd.IS_MOBILE,
featureFlags: res.locals.sd.FEATURE_FLAGS,
userPreferences: res.locals.sd.USER_PREFERENCES,
...context,
Expand Down
1 change: 0 additions & 1 deletion src/System/Router/__tests__/serverRouter.jest.enzyme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ describe("serverRouter", () => {
"initialMatchingMediaQueries",
"isEigen",
"isLoggedIn",
"isMobile",
"relayEnvironment",
"router",
"routes",
Expand Down

0 comments on commit 3036572

Please sign in to comment.