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

Throw an error when layout property is not string #4142

Merged
merged 1 commit into from Oct 20, 2018
Merged

Conversation

suusan2go
Copy link

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Resolves: #4035

Avoid using non-string value as layout property.

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)
  • All new and existing tests are passing.

@codecov-io
Copy link

codecov-io commented Oct 18, 2018

Codecov Report

Merging #4142 into dev will increase coverage by 0.44%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             dev    #4142      +/-   ##
=========================================
+ Coverage   81.8%   82.24%   +0.44%     
=========================================
  Files         29       29              
  Lines       1561     1549      -12     
  Branches     409      408       -1     
=========================================
- Hits        1277     1274       -3     
+ Misses       224      216       -8     
+ Partials      60       59       -1
Impacted Files Coverage Δ
packages/core/src/nuxt.js 95.74% <0%> (-0.09%) ⬇️
packages/common/src/utils.js 80.72% <0%> (ø) ⬆️
packages/cli/src/common/utils.js 0% <0%> (ø) ⬆️
packages/cli/src/commands/dev.js 0% <0%> (ø) ⬆️
packages/builder/src/webpack/base.js 98.41% <0%> (ø) ⬆️
packages/common/src/options.js 86.23% <0%> (ø) ⬆️
packages/builder/src/builder.js 96.46% <0%> (ø) ⬆️
packages/builder/src/webpack/utils/postcss.js 95.34% <0%> (ø) ⬆️
packages/core/src/renderer.js 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b0074ce...7c9ffca. Read the comment docs.

@manniL manniL requested a review from pi0 October 18, 2018 12:51
@pi0
Copy link
Member

pi0 commented Oct 18, 2018

Am I missing something or we should support layout as a function for dynamic layouts?

@manniL
Copy link
Member

manniL commented Oct 18, 2018

@pi0 Dang, you are correct! Almost forget that use case 🙈

@suusan2go Could you do a check for string or function? Sorry!

@suusan2go
Copy link
Author

@pi0 @manniL
I think check for function is unnecessary.
because if layout is a function, it seems to call layout = layout(app.context) before setLayout.
https://github.com/nuxt/nuxt.js/blob/dev/packages/app/template/server.js#L123-L128
https://github.com/nuxt/nuxt.js/blob/dev/packages/app/template/client.js#L455-L464

Although I checked the examples/dynamic-layouts and it works perfect.

@pi0
Copy link
Member

pi0 commented Oct 19, 2018

@suusan2go. Thanks for checking that. I just wanted to to endure that it's happening.

@manniL manniL self-requested a review October 19, 2018 07:45
@manniL
Copy link
Member

manniL commented Oct 19, 2018

Well, I fast to fast with my conclusion there 🙈 @suusan2go Thank you for looking into it!

The last thing I'd consider is maybe only throwing an Error if you are in debug mode 🤔

@suusan2go
Copy link
Author

@manniL Thank you for your comment! I changed my code to throw an error only in debug mode.

@pi0 pi0 merged commit f5530ad into nuxt:dev Oct 20, 2018
@lock
Copy link

lock bot commented Nov 19, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 19, 2018
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Throw an error when layout is no string
5 participants