This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🙈 Fix `<style>` elements bleeding into the document `<body>`, a place where they [do not belong](mui/material-ui#26561 (comment)) ℹ️ Removed Remix/React control of the entire document to drastically simplify emotion logic. This also means the Remix `meta`/`link` features no longer work -> [react-helmet](https://github.com/nfl/react-helmet) Closes #221
- Loading branch information
Showing
3 changed files
with
91 additions
and
147 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,13 @@ | ||
import type { PropsWithChildren } from "react"; | ||
import { CacheProvider } from "@emotion/react"; | ||
import { useMemo, useState } from "react"; | ||
import { hydrate } from "react-dom"; | ||
import { RemixBrowser } from "remix"; | ||
import { createEmotionCache, EmotionClientContext } from "~app/emotion"; | ||
import { createEmotionCache } from "~app/emotion"; | ||
|
||
function ClientWrapper({ children }: PropsWithChildren<unknown>) { | ||
const [cache, setCache] = useState(createEmotionCache()); | ||
|
||
const ctx = useMemo( | ||
() => ({ | ||
reset: () => setCache(createEmotionCache()), | ||
}), | ||
[], | ||
); | ||
|
||
return ( | ||
<EmotionClientContext.Provider value={ctx}> | ||
<CacheProvider value={cache}>{children}</CacheProvider> | ||
</EmotionClientContext.Provider> | ||
); | ||
} | ||
const cache = createEmotionCache(); | ||
|
||
hydrate( | ||
<ClientWrapper> | ||
<CacheProvider value={cache}> | ||
<RemixBrowser /> | ||
</ClientWrapper>, | ||
document, | ||
</CacheProvider>, | ||
document.getElementById("__remix"), | ||
); |
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