-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #347 from tgstation/WhatsNext
Setup network specific handling and use preloaded queries
- Loading branch information
Showing
26 changed files
with
659 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { lazy } from "react"; | ||
import { Environment } from "react-relay"; | ||
import { RouteObject } from "react-router-dom"; | ||
|
||
import { HomeCardPermissionsQuery } from "./graphql/__generated__/HomeCardPermissionsQuery.graphql"; | ||
import HomeCardPermissions from "./graphql/HomeCardPermissions"; | ||
|
||
import useSession from "@/context/session/useSession"; | ||
import devDelay from "@/lib/devDelay"; | ||
import RouteQueryLoader from "@/lib/RouteQueryLoader"; | ||
|
||
const Home = lazy(async () => await devDelay(() => import("./Home"), "Component Load: Home")); | ||
|
||
const HomeRouteLoader = (relayEnvironment: Environment, partialRoute: RouteObject): RouteObject => { | ||
const session = useSession(); | ||
return RouteQueryLoader<HomeCardPermissionsQuery>( | ||
relayEnvironment, | ||
HomeCardPermissions, | ||
() => { | ||
if (!session.currentSession) { | ||
return null; | ||
} | ||
|
||
return { | ||
userID: session.currentSession.userID | ||
}; | ||
}, | ||
partialRoute, | ||
queryRef => <Home queryRef={queryRef} /> | ||
); | ||
}; | ||
|
||
export default HomeRouteLoader; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.