erikras / erikras/react-redux-universal-hot-example

Scroll behavior with `fetchData` is suboptimal

Open
#755 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

To reproduce:

Change the `fetchData` in `Widgets.js` to `fetchDataDeferred`—the easiest way to do this is to simply change this line:

``` es6
@connectData(null, fetchDataDeferred)
```

to this:

``` es6
@connectData(fetchDataDeferred)
```

Now,
1. Run the app, go to the home page, and scroll down a bit. Then click "Widgets" in the title bar. You'll see the page scroll to the top _before it switches the page_, then the page will load.
2. Hit your browser's Back button, and you'll see that you're scrolled to the top of the home page, rather than where you were scrolled previously.
3. Reload the page. The previous scroll point will be restored.

It's a bit like this.

![hhttps://xkcd.com/1309/](https://imgs.xkcd.com/comics/infinite_scrolling.png)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.