fix(vue-renderer): read target
from class instead of serverContext
#7752
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
renderRoute
method assumes thatthis.serverContext.nuxt.options
is a valid path, but that does not seem like a good assumption AFAICT. We could defensively check for its existence, but I think the correct thing to do here, is to usethis.options
instead.I'm not sure how this was working before, but I hit this particular problem while trying to use
nuxt-lambda
which creates a minimalserverContext
that doesn't includeserverContext.nuxt.options
. See: https://github.com/pimlie/nuxt-lambda/blob/master/src/renderer.js#L8-L21 -- I freely admit that the bug could lie there. I tried to find some authoratative documentation onserverContext
but was unsuccessful.Types of changes
Description
Presently
renderRouter
assumes thatserverContext
has anuxt.options.target
field. This seems at odds with other areas within the code that need to accesstarget
and get it directly fromserverContext.options
. To remain consistent and remove (what I think is) an errant path, we should update the assignment ofserverContext.target
usingthis.options.target
instead ofthis.serverContext.nuxt.options.target
Checklist:
I tried to run the tests locally but failed hard. Could not get jest to work.