Skip to content

with-apollo: client-side routing not preloading data #7994

@timojokinen

Description

@timojokinen

Examples bug report

Example name

with-apollo

Describe the bug

Preloading data only works server side. When using client side routing the data from the tree is not preloaded which results in the page rendering before the data was loaded. Again this results in "flashing" / "jumping" of the content because we need to display a loading indicator.

To Reproduce

  1. Clone the with-apollo example and run it
  2. Go to the about page
  3. Navigate from about page to index page
  4. Loading indicator shows for a few milliseconds before showing actual loaded content

Expected behavior

I'd expect the same behavior for client side routing as for server side rendering or at least an opt-in option. History pushState should happen only after the data has been loaded from the subtree.
As the NextJS documentation states:

Client-side routing behaves exactly like the browser:

  1. The component is fetched.
  2. If it defines getInitialProps, data is fetched. If an error occurs, _error.js is rendered.
  3. After 1 and 2 complete, pushState is performed and the new component is rendered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions