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

feat(server): allow passing loadingTimeout and other arguments to renderAndGetWindow() #6178

Merged
merged 5 commits into from
Aug 5, 2019

Conversation

yutanoma
Copy link

@yutanoma yutanoma commented Aug 3, 2019

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: #6008

Currently, it is impossible to give the loadingTimeout option to the renderAndGetWindow from outside. This is very inconvenient, since we cannot avoid the following error.

Error {
  message: 'Components loading in renderAndGetWindow was not completed in 2s',
}

If we can give the loadingTimeout option from the globals option in nuxt.config.js, we can solve this problem. In fact this solution is suggested in #6008 (comment).

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.

@yutanoma yutanoma changed the title add: argument give argument 'loadingTimeout' to renderAndGetWindow function Aug 3, 2019
@yutanoma yutanoma changed the title give argument 'loadingTimeout' to renderAndGetWindow function fix: give argument 'loadingTimeout' to renderAndGetWindow function Aug 3, 2019
@codecov-io
Copy link

codecov-io commented Aug 3, 2019

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##             dev    #6178       +/-   ##
==========================================
+ Coverage   50.8%   95.74%   +44.93%     
==========================================
  Files         80       80               
  Lines       2655     2655               
  Branches     683      683               
==========================================
+ Hits        1349     2542     +1193     
+ Misses      1008       97      -911     
+ Partials     298       16      -282
Flag Coverage Δ
#e2e 100% <ø> (ø) ⬆️
#fixtures 50.8% <ø> (ø) ⬆️
#unit 92.42% <ø> (?)
Impacted Files Coverage Δ
packages/server/src/server.js 97.72% <ø> (+34.09%) ⬆️
packages/webpack/src/config/client.js 98.07% <0%> (+3.84%) ⬆️
packages/webpack/src/utils/perf-loader.js 100% <0%> (+5.26%) ⬆️
packages/webpack/src/config/base.js 94.89% <0%> (+6.12%) ⬆️
packages/utils/src/lang.js 100% <0%> (+6.66%) ⬆️
packages/core/src/module.js 98.33% <0%> (+10%) ⬆️
packages/utils/src/context.js 100% <0%> (+11.11%) ⬆️
packages/cli/src/commands/index.js 11.11% <0%> (+11.11%) ⬆️
packages/utils/src/resolve.js 96.07% <0%> (+13.72%) ⬆️
packages/config/src/config/build.js 100% <0%> (+14.28%) ⬆️
... and 45 more

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 da4615a...4dae80d. Read the comment docs.

Copy link
Member

@clarkdo clarkdo left a comment

Choose a reason for hiding this comment

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

Since globals are not used only for renderAndGetWindow, so we'd better not add loadingTimeout in it.

How about adding third parameter ?

  renderAndGetWindow (url, jsdomOpts, {
    loadedCallback = this.globals.loadedCallback,
    loadingTimeout = 200,
    ssr = this.options.render.ssr,
    globals = this.globals
  } = {}) {
    return renderAndGetWindow(url, jsdomOpts, {
      loadedCallback,
      ssr,
      globals,
      loadingTimeout
    })
  }

@yutanoma
Copy link
Author

yutanoma commented Aug 4, 2019

Ah, I totally agree. It is definitely better since it is easy to customize the arguments externally. Thank you!

@pi0 pi0 changed the title fix: give argument 'loadingTimeout' to renderAndGetWindow function feat(server): allow passing loadingTimeout and other arguments to renderAndGetWindow() Aug 5, 2019
@pi0 pi0 merged commit a87f5dd into nuxt:dev Aug 5, 2019
@pi0 pi0 mentioned this pull request Aug 5, 2019
pi0 pushed a commit that referenced this pull request Aug 20, 2019
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

renderAndGetWindow times out when testing with Ava and TypeScript
5 participants