Update `examples/with-emotion` to remove _document.js?
See original GitHub issueFeature request
Is your feature request related to a problem? Please describe.
The examples/with-emotion
example is using Emotion 10.
According to the Emotion SSR docs, the _document.js
file is no longer required:
Suggested Solution: Maybe this file can be removed?
Secondly, I noticed that the cache is using the original emotion
as a dependency:
Suggested Solution: Maybe this can be switched to use the createCache
function from @emotion/cache
instead?
Describe the solution you’d like
Solutions suggested above.
Describe alternatives you’ve considered
Leave things how they are (more code, but maybe still works?)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Element.remove() - Web APIs - MDN Web Docs
The Element.remove() method removes the element from the DOM. ... const element = document.getElementById('div-02'); element.remove(); ...
Read more >How do I remove documents using Node.js Mongoose?
Update for Mongoose v5.5.3 - remove() is now deprecated. Use deleteOne() , deleteMany() or findOneAndDelete() instead.
Read more >Removing Markers | Maps JavaScript API - Google Developers
This example creates a map where each click by the user creates a marker. Click the buttons to hide or delete all of...
Read more >react-hydration-error - Next.js
For example if pages/_document is missing and the Babel plugin is not added. Possible fix for Styled Components: If you want to leverage...
Read more >How to delete a specific nested subdocument completely from ...
mongodb will scan the whole collection and “technically” updates every document by removing addresses matching "_id": ObjectId(" ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Update: I was able to replicate the FOUC when usinggetStaticProps
withrevalidate
:Update: No longer an issue. See comment below.
1.) Clone repo:
git clone git@github.com:mattcarlotta/emotion-fouc.git
2.) Cd into project:
cd emotion-fouc
3.) Install, build and start local build:
yarn && yarn build && yarn start
4.) Visit http://localhost:3000/ (should load page without FOUC), then do a hard refresh at least 5 times:
ctrl/cmd + f5
(should notice FOUC).5.) Open chrome tab, open dev tools, under
Network
tab change theOnline
option toSlow 3G
and hard refresh again.6.) The page will show FOUC during initial page load:
and styled components once loaded:
Switching to
@emotion/cache
without extracting styles in the_document
appears to be working well in development and in production. Ran some e2e tests using cypress in staging, as well as some unit tests withjest-emotion
, and they all passed. In terms of performance, appears to be no loss switching between the two in production:Before (custom document): Lighthouse After (cache): Lighthouse
Then again, I only use
@emotion/styled
with the@emotion/babel-preset-css-prop
babel preset, so you (or whoever) may want to test their other APIs (likejsx
andcss
from@emotion/core
, as well testing in v11.0.x-x-next) before completely removing the _document page from the official example(s).