-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert loader-page, which was breaking Role Selector
- Loading branch information
1 parent
38d1cd2
commit e50b63c
Showing
6 changed files
with
59 additions
and
85 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from 'react'; | ||
import {camelCaseKeys} from '~/helpers/page-data-utils'; | ||
import usePageData from '~/helpers/use-page-data'; | ||
import {setPageTitleAndDescriptionFromBookData, useCanonicalLink} from '~/helpers/use-document-head'; | ||
import LoadingPlaceholder from '~/components/loading-placeholder/loading-placeholder'; | ||
import Error404 from '~/pages/404/404'; | ||
|
||
function LoadedPage({ | ||
Child, data, props, doDocumentSetup, noCamelCase | ||
}) { | ||
const camelCaseData = React.useMemo( | ||
() => noCamelCase ? data : camelCaseKeys(data), | ||
[data, noCamelCase] | ||
); | ||
|
||
useCanonicalLink(doDocumentSetup); | ||
React.useEffect(() => { | ||
if (doDocumentSetup) { | ||
setPageTitleAndDescriptionFromBookData(data); | ||
} | ||
}, [data, doDocumentSetup]); | ||
|
||
if (data.error) { | ||
return (<Error404 />); | ||
} | ||
|
||
return ( | ||
<Child {...{data: camelCaseData, ...props}} /> | ||
); | ||
} | ||
|
||
export default function LoaderPage({ | ||
slug, Child, props={}, preserveWrapping=false, doDocumentSetup=false, | ||
noCamelCase=false | ||
}) { | ||
const data = usePageData(slug, preserveWrapping, noCamelCase); | ||
|
||
if (!data) { | ||
return <LoadingPlaceholder />; | ||
} | ||
|
||
return (<LoadedPage {...{Child, data, props, doDocumentSetup, noCamelCase}} />); | ||
} |
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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