-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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(server-renderer): Make sure dir is defined #8497
base: main
Are you sure you want to change the base?
Conversation
There is a precedent for this in #6671. That PR added support for It works fine without SSR, but throws an error once SSR is enabled. This PR does fix that: Much like with #6671, real use cases would involve I have two small concerns about the specifics of the proposed change here:
|
Hey! Thanks for the feedback!
In this case, is there a reason to update it? This PR is made to handle edge cases, that given the lack of issues reported around it are not that frequent. I think it would be safe to keep dir as is, but I'd like to hear your opinion about this!
When I originally made this PR I wasn't that familiar with testing as the vue ecosystem was pretty new to me, but I believe I could try to make some tests for it |
I think so, yes. The similar change in #6671 also updated the types. The function If the type of
The test for this should be pretty simple, most likely a small addition to |
PR summary:
This PR is a slight yet beneficial change that fixes an issue accidentally discovered with v-model, which breaks the entire app for one reload. This issue, initially occurred in a nuxt v3 app (if it matters) upon launching an app after a start command (
npm run dev
, for example) would break it for the first reload with the following error message:Cannot read properties of undefined (reading 'getSSRProps')
. This PR makes sure dir is defined before trying to access getSSRProps, which although only studied by me with v-model, would probably fix many more edge cases.Current Behavior (At least in my case):
You get hit with an error screen and the error message and are required to manually reload the page for your content to render. Note: The content loads fine after the first reload, it will not show again until restarting your development server.
Why this PR is useful:
The current behavior is not ideal, it breaks the entire page and is just unnecessary to require a manual reload. Additionally, vue already warns about the directive it fails to resolve (again, at least in my case), so this PR makes sure that no matter what framework you use, you won't be hit with an error screen like I did with the entire loading requiring a manual refresh, as that's just something extra that might not be that necessary.