This file contains hidden or 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
| import { useEffect } from 'react'; | |
| import { graphql, readInlineData } from 'react-relay'; | |
| import { useHistory } from '../routing/useHistory'; | |
| import { useAuth_user } from './__generated__/useAuth_user.graphql'; | |
| const useAuthFragment = graphql` | |
| fragment useAuth_user on User @inline { | |
| id |
This file contains hidden or 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
| import { useEffect, useRef } from 'react'; | |
| import { useHistory } from 'react-router-dom'; | |
| export const usePrompt = (when: boolean, message: string = 'Are you sure you want to quit without saving your changes?') => { | |
| const history = useHistory(); | |
| const self = useRef(null); | |
| const onWindowOrTabClose = event => { | |
| if (!when) { |
This file contains hidden or 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
| time_namelookup: %{time_namelookup}\n | |
| time_connect: %{time_connect}\n | |
| time_appconnect: %{time_appconnect}\n | |
| time_pretransfer: %{time_pretransfer}\n | |
| time_redirect: %{time_redirect}\n | |
| time_starttransfer: %{time_starttransfer}\n | |
| ----------\n | |
| time_total: %{time_total}\n |
This file contains hidden or 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
| // ---- routes.ts --- | |
| import * as React from 'react'; | |
| import { prepareQuery } from '../../relay'; | |
| export default [ | |
| { | |
| path: path => `${path}Home`, | |
| component: React.lazy(() => import('./Home')), | |
| prepare: () => { |
This file contains hidden or 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
| import { ROOT_ID } from 'relay-runtime'; | |
| import { useRelayEnvironment } from 'react-relay/hooks'; | |
| import { useLocation, useHistory } from 'react-router-dom'; | |
| import { commitLocalUpdate } from 'react-relay' | |
| import { useMutation } from 'relay-hooks/lib'; | |
| import { AuthUserMutation } from 'mutations/AuthUserMutation'; | |
| export const TOKEN_KEY = 'KEY'; |
This file contains hidden or 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
| # GitHub.com | |
| Host github.com | |
| Preferredauthentications publickey | |
| IdentityFile ~/.ssh/id_rsa_github | |
| # GitLab.com | |
| Host gitlab.com | |
| Preferredauthentications publickey | |
| IdentityFile ~/.ssh/id_rsa_gitlab |
This file contains hidden or 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
| import { useState, useEffect } from 'react'; | |
| import NetInfo from '@react-native-community/netinfo'; | |
| const useInternetReachable = () => { | |
| const [isReachable, setIsReachable] = useState(false); | |
| const [isLoading, setIsLoading] = useState(true); | |
| useEffect(() => { | |
| const unsubscribe = NetInfo.addEventListener(({ isInternetReachable }) => { | |
| if (typeof isInternetReachable !== 'boolean') return; |
This file contains hidden or 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
| // eslint-disable-next-line | |
| import { mongooseLoader } from '@entria/graphql-mongoose-loader'; | |
| import DataLoader from 'dataloader'; | |
| import { ConnectionArguments } from 'graphql-relay'; | |
| import { Model, Types } from 'mongoose'; | |
| import { buildMongoConditionsFromFilters } from '@entria/graphql-mongo-helpers'; | |
| import { validateContextUser } from './validateContextUser'; | |
| import { withConnectionCursor } from './withConnectionCursor'; |
This file contains hidden or 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
| import { useCallback } from 'react'; | |
| import { matchRoutes, MatchedRoute, RouteConfig } from 'react-router-config'; | |
| const prepareMatches = <Params extends { [K in keyof Params]?: string }>(matches: Array<MatchedRoute<Params>>) => { | |
| return matches.map(match => { | |
| const { route, match: matchData } = match; | |
| const prepared = route.prepare ? route.prepare(matchData.params) : {}; | |
| const Component = route.component.get(); | |
| if (Component == null) { | |
| route.component.load(); // eagerly load |
This file contains hidden or 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
| const App = React.memo( | |
| ({ | |
| node: { | |
| items: { totalCount, ...items } | |
| }, | |
| relay | |
| }) => { | |
| const [fulltext, setFulltext] = useState('') | |
| const fulltextDebounced = useDebounce(fulltext, 300) | |
| const [{ sort, order }, updateSort] = useSort({ sort: 'name', order: 'asc' }) |