-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Posts: ensure a fetch on mounting for post-list-fetcher #2965
Conversation
Here's a video showing posts-list getting updated right away when reopened (using this branch in the desktop). https://cloudup.com/c_5u5syesQk |
@@ -126,7 +126,7 @@ PostListFetcher = React.createClass( { | |||
|
|||
componentDidMount: function() { | |||
var postListStore = postListStoreFactory( this.props.postListStoreId ); | |||
this._poller = pollers.add( postListStore, actions.fetchUpdated, { interval: 60000, leading: false } ); | |||
this._poller = pollers.add( postListStore, actions.fetchUpdated, { interval: 60000, leading: true } ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Omitting the attribute should set it to true as well.
This makes sense to me. I believe we may have had a situation where the controller initiated a fetch at the start, and the poller would run another one immediately. For what is worth, leading was set to false since the start here. |
Yes, there is definitely a double-fetch happening when you first load. I'll see if I can figure it out. |
I wonder if we could increase the polling interval as well. |
@rralian we don't use the post-list-fetcher in the reader. :) we handle kicking off the initial fetch up in the controller. I've been meaning to move to post-list-fetcher, but it's never bubbled up and gotten done. |
9528971
to
151bb2b
Compare
The double-fetch was happening because we were using some pagination logic to trigger the first fetch. I just removed that in my latest commit and it's working fine for me.
@blowery cool, thanks for checking in.
@mtias Maybe, but I wouldn't do so here. If we want to tweak, I think we also need to have some idea of what effect we are trying to create, and then track against a metric to see if the tweak is a success. TestingWe use http://calypso.localhost:3000/posts/ You can test this by watching the network tab and filtering on "posts" to see that only a single fetch happens initially, and then polling fetches happen every minute. And of course you'll see pagination fetches as necessary if you scroll. Also test to make sure the we're not screwing up pagination. The list of posts when paginated (scrolling past 20 posts) should be the same in this branch that you would see in wpcalypso. You can also test that this helps pages reflect recent changes. Open the posts-list page. Then edit the title of one of the posts in another tab or window. Then move back to the posts-list page. You should see the new title reflected after a split-second. In master you could be waiting up to a minute to see the change. |
oh, btw @blowery... I looked around and the only other instance where we use |
👍 |
Thanks for the heads up @rralian, I'll check into it. |
argh... I noticed a double-fetch on the /posts page with sites that have < 20 posts (probably coming from infinite-scroll logic). need to track that down. also the draft drawer usually works for me, but occasionally it does this: It appears to be some sort of rendering issue in the browser, as when I inspect the items they contain the correct html. And if I toggle a css rule from the inspector, it fixes it. If I can confirm this sometimes happens in master, I won't consider it a blocker here. In any case though, back to digging a bit more. |
151bb2b
to
4e8ae19
Compare
ok, figured it out. Previously when So I'm still using polling to initiate Ready for another look. |
39b4a54
to
73c3017
Compare
This should address stale data that can otherwise be shown in the desktop app.
cdaaf03
to
1161110
Compare
🚢 |
Posts: ensure a fetch on mounting for post-list-fetcher
I tried this in #2965 but I had to back it out before it hit production. It worked fine on mounting and for pagination, but I had removed the mechanism by which the component triggered a new query with different props. Woops. So now I'm using a leading polling query, but I've added some protection against double-fetching on the fetchNextPage method.
This should address stale data that can otherwise be shown in the desktop app. I don't think this should have much of an impact on server load, like decreasing the polling interval would.
@blowery what do you think of this? I'm really not sure why we didn't want post-list-fetcher to trigger a fetch on mounting in the first place. Anything in the reader that you'd be concerned about?
Testing
I was recreating a reported issue in the desktop app by doing the following in desktop and calypso master.
Then by running the desktop app with this branch for calypso, if you do the same steps as above, you will still see the old title for a split-second, but then it should update to reflect the new title.