mozilla / addons

☂ Umbrella repository for Mozilla Addons ✨
Other
125 stars 41 forks source link

Reload the Primary Hero shelf every time the home page is displayed #13453

Closed bobsilverberg closed 5 years ago

bobsilverberg commented 5 years ago

Currently, we load the data for the Primary Hero shelf the first time the home page is accessed, and we store it in the redux state. When the home page is visited again, in the same tab/session, it detects that the data is already loaded and does not fetch the data again. The result of this is that the Primary Hero shelf will never change for a given session unless the user manually refreshes the browser.

We would like the Primary Hero shelf to refresh its contents every time the page is visited.

bobsilverberg commented 5 years ago

In terms of implementation, it was suggested that we could use the LOCATION_CHANGE action to clear the data for the hero shelf, which would then indicate to the home page that it needs to refetch that data if and when it is revisited.

There is also a question about whether we should separate the actions that fetch and load the hero data from the other actions that fetch and load the other home page data. Doing so would put less of a burden on the home page for when it is revisited, but it is also a significant amount of work, which could be avoided if we simply keep things as they are and fetch and load all data with a single set of actions.

AlexandraMoga commented 4 years ago

Before this patch, in order to see the fetch-ing of the homepage hero, you had to do the steps mentioned in mozilla/addons#13442

Now, the hero is re-fetched if you navigate away from and back to the homepage => you'll see a different primary and secondary hero: 2019-09-25_09-52-02

@bobsilverberg while testing this, I've noticed that we don't have placeholders/loading indicators for the homepage heroes (primary and secondary). I suppose we should have something to indicate that this area is reserved for some content. What do you think?

bobsilverberg commented 4 years ago

@bobsilverberg while testing this, I've noticed that we don't have placeholders/loading indicators for the homepage heroes (primary and secondary). I suppose we should have something to indicate that this area is reserved for some content. What do you think?

Yes, I already opened https://github.com/mozilla/addons/issues/13461 for this.