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

[Nuxt.js] Datepicker stop working on SSR #298

Closed
juan-manuel-alberro opened this issue Sep 3, 2017 · 5 comments
Closed

[Nuxt.js] Datepicker stop working on SSR #298

juan-manuel-alberro opened this issue Sep 3, 2017 · 5 comments

Comments

@juan-manuel-alberro
Copy link

Overview of the problem

Buefy version: 0.5.1
Vuejs version: 2.4.2
OS/Browser: Mac / Linux
Nuxt.js: 1.0.0-rc8

Description

The datepicker component works perfect in Nuxt until you refresh the page and the page is rendered in the server side, you get navigator is not defined

Steps to reproduce

  1. Add a date picker component into a .vue file
  2. Navigate to that page and verify that the component is working
  3. Refresh page (cmd + R or F5)
  4. 💣

Expected behavior

Render the date picker without any error

Actual behavior

Page is not working since navigator is not defined (screenshot below)

@jtommy jtommy closed this as completed in 9d56f97 Sep 4, 2017
@jtommy
Copy link
Member

jtommy commented Sep 4, 2017

@juan-manuel-alberro It's fixed!
Anyway if you want to use native datepicker, you have to inject current user agent to enable the correct mobile detection because Buefy depends on existence of window.navigator.userAgent to do it.

@juan-manuel-alberro
Copy link
Author

Lovely, thanks @jtommy!

@davegriffin
Copy link

davegriffin commented May 1, 2019

We've also seen a similar issue with a Nuxt.js project and observed a different and somewhat non-sensical error message in the server logs related to the time/date pickers (expected Date, got Date), but wrapping the b-datepicker / b-timepicker component references in <no-ssr> </no-ssr> tags resolved the issue. (The pickers were working fine on the client, just throwing errors in the server log.)

Just an FYI for anyone looking for a workaround.

@jtommy
Copy link
Member

jtommy commented May 1, 2019

Thanks @davegriffin but maybe the correct place is this issue https://github.com/buefy/nuxt-buefy/issues

@davegriffin
Copy link

Fair point! Googling found this first, but I'll make mention of it there as well (perhaps it can be resolved!) Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants