-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Default document rendering #156
base: master
Are you sure you want to change the base?
Conversation
options, | ||
pagePath: DOCUMENT_PATH, | ||
}); | ||
const { useDocument } = options; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is exactly how useApp
behaves.
Hi @Meemaw, thanks for this PR and all the maintenance job during this days ❤️ . I still haven't had the opportunity of fully digging into this pr. I'll do as soon as possible. Does it actually concern and fix #154? At a first glance I'd expect this library to not render the 🙌 |
Actually it seems that the issue is in the setup (perhaps missing
Hmm 🤔 I'm actually not sure which one I would prefer. On one hand I see many advantages to doing full Next.JS render even when
From what I see the main point of even preserving How do you see it? |
Hi @Meemaw, Even without document, this library could be useful in quite a lot projects. Especially simple ones for which browser testing would be overkill or too expensive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we went this direction we might consider taking an alternative testing strategy since I feel like we're exposing a lot of Next.js' implementation details as test expectation.
I currently don't have the full picture of our document tests, may we now have a bit of redundancy?
BTW, I like the way this approach simplify our code. Probably the cost of it gets reflected onto tests.
If you agree I'd keep the decision for after the upcoming release. We're currently tackling quite a few issues which I'd like to see fixed before proceeding further. In the meanwhile let's keep talking. 👍
<script | ||
id="__NEXT_DATA__" | ||
type="application/json" | ||
dangerouslySetInnerHTML={{ | ||
__html: | ||
'{"page":"/page","query":{},"buildId":"next-page-tester","props":{}}', | ||
}} | ||
></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we consider this output (along with next-head-count
meta, data-n-css
noscript..) implementation details not depending on our code and keep them out from out expectations?
If Next.js added a new next-tag in a minor version, our test would get red, wouldn't them?
What kind of change does this PR introduce?
Fix default document rendering.
Fixes #154
What is the current behaviour?
When
useDocument=false
we didn't properly render the Next.JS document (we skipped it) which meant that anySEO
elements defined in custom_app
or inpage
were not rendered.This is wrong behaviour that is not in line with
useApp
where this flag only controls if we should use custom_app
component, but not changing the rendering flow.What is the new behaviour?
useDocument=false
is now inline with theuseApp=false
behaviour and document rendering flow is always correct.This change also simplifies the code and lets us get rid of some weird conditions.
Does this PR introduce a breaking change?
What changes might users need to make in their application due to this PR?
Other information:
Please check if the PR fulfills these requirements: