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

handleRoute called twice, one on server, one on client #973

Open
hong-duc opened this issue Dec 16, 2017 · 0 comments
Open

handleRoute called twice, one on server, one on client #973

hong-duc opened this issue Dec 16, 2017 · 0 comments

Comments

@hong-duc
Copy link

I have a page that fetch data when request to page

export default class HomePage {
  handleRoute(next) {
    this.title = SettingService.getSetting('title_trang_chu').then(result => {
      return result.value.value;
    });
    return next();
  }

  getElements() { ........

But the SettingService.getSetting get called twice and that make 2 request to the api server.

But this only happen if the getElements method return some elements, if it return empty array handleRoute will not be called on the client

Is this the expected behaviour ? Or I am using it wrong ?
I just want to fetch data once when there is a request to a page and then wait for the result then render page

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

1 participant