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

fix(vue-app): handle fallback on generated page #7718

Merged
merged 5 commits into from
Jul 16, 2020
Merged

Conversation

Atinux
Copy link
Member

@Atinux Atinux commented Jul 14, 2020

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

This is an advances use case mentioned by @Akryum when you want a static fallback (not SPA) using a pages/404.vue and a Netlify redirect. Hitting an unknown page will fetch the wrong payload, this is why I use NUXT.routePath to fetch the generated page to fetch the payload.

@pi0 I am wondering if we should no directly remove _app.context.route.path directly in fetchPayload(NUXT.routePath || _app.context.route.path)

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-commenter
Copy link

codecov-commenter commented Jul 14, 2020

Codecov Report

Merging #7718 into dev will increase coverage by 0.00%.
The diff coverage is 50.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##              dev    #7718   +/-   ##
=======================================
  Coverage   68.82%   68.83%           
=======================================
  Files          90       90           
  Lines        3820     3821    +1     
  Branches     1034     1034           
=======================================
+ Hits         2629     2630    +1     
  Misses        968      968           
  Partials      223      223           
Flag Coverage Δ
#unittests 68.83% <50.00%> (+<0.01%) ⬆️
Impacted Files Coverage Δ
packages/cli/src/commands/generate.js 88.23% <ø> (ø)
packages/cli/src/commands/start.js 100.00% <ø> (ø)
packages/cli/src/utils/generate.js 0.00% <0.00%> (ø)
packages/cli/src/utils/serve.js 72.41% <66.66%> (+2.04%) ⬆️

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 361afcb...6d95a4b. Read the comment docs.

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

Also, is it also possible to add a redirect scenario to one of the test fixtures?

@Atinux
Copy link
Member Author

Atinux commented Jul 14, 2020

Will do :)

@Atinux
Copy link
Member Author

Atinux commented Jul 15, 2020

One thing also, because NUXT.routePath and _app.context.route.path are different, it will do a full render on client-side (like SPA fallback) because of https://github.com/nuxt/nuxt.js/blob/fix/fallback-with-404-page/packages/vue-app/template/client.js#L892

@Atinux Atinux merged commit 6ab65fb into dev Jul 16, 2020
@Atinux Atinux deleted the fix/fallback-with-404-page branch July 16, 2020 17:32
@pi0 pi0 mentioned this pull request Jul 22, 2020
@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.

None yet

4 participants