Skip to content
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

Avoiding duplicated line on loadable options. #5722

Conversation

andersonleite
Copy link
Contributor

The line delete loadableOptions.ssr will always be executed so doing it first and then going to the "if clause".

@@ -115,11 +115,10 @@ export default function dynamic (dynamicOptions: any, options: NextDynamicOption

// support for disabling server side rendering, eg: dynamic(import('../hello-world'), {ssr: false})
if (typeof loadableOptions.ssr === 'boolean') {
delete loadableOptions.ssr
if (!loadableOptions.ssr) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If ssr: true this will break, since the line above is deleting the value

Copy link
Member

@timneutkens timneutkens Nov 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a test for setting ssr: true, could you create a PR for that? 🙏

@timneutkens
Copy link
Member

Since the current behavior is correct as per my review I'm going to close this PR, I'd love to merge a test for ssr: true though, so that we can't break it in the future.

timneutkens pushed a commit that referenced this pull request Nov 25, 2018
**What's this PR?**
Based on the feedback on [this PR](#5722) @timneutkens asked me to create a test for `ssr: true`

**What's it do?**

- adds a test for setting `ssr: true` - /basic
- adds a test for setting `ssr: true` - /production
@lock lock bot locked as resolved and limited conversation to collaborators Nov 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants