WordPress-iOS
WordPress-iOS copied to clipboard
Bug: Stats Widget does not load when a new site appears after refreshing "My Site" tab
Expected behavior
Stats Widget should load when a new site appears after refreshing "My Site" tab.
Actual behavior
Stats Widget stays in the error state when a new site appears after refreshing "My Site" tab. Removing and readding Stats Widget does not help.
Steps to reproduce the behavior
- Create WordPress account without any site
- Log In into the app
- Add WordPress "Stats Widget" (All Time / This Week / Today) on the home screen
- Go to WordPress.com website and create a new site
- Return to the app
- Open "My Site" tab
- Pull to Refresh
- New site information loads
- Got to Home screen
- Notice Stats widget not reloading
The Stats Widget doesn't even reload after:
- Removing and readding Stats Widget
- Visiting Stats view in the app
Tested on iPhone 13 mini, iOS 15.4, WPiOS 20.2
Workaround
Log out and log in again in the app with the same account.
Video
https://user-images.githubusercontent.com/4062343/174753506-5c1adecd-a6b3-40d8-9781-085cf2b2566b.mov
Technical Details
Pull to Refresh triggers syncBlogs()
in MySiteViewController
. When updateDefaultBlogIfNeeded
in AccountService
is called, account.primaryBlogID
does not exist yet. Therefore Default Site ID
is not saved to userDefaults
in the process with WPStatsHomeWidgetsUserDefaultsSiteIdKey
. Stats Widget relies on Default Site ID
value. There could possibly be more values that are set during login but are not set during this pull to refresh action, this is the main concern.
Check updateBlogWithRemoteBlog
in BlogService
. There's already a detection of a new blog. It might make sense to throw siteCreated
notification there.
Hi @staskus, the video above seems to be broken for me, is it working for you?
![]() |
---|
After posting the above comment, the video above started displaying correctly 🤷. So please ignore the above comment.
Note: Consider the opposite case.
- In the app log in to account that has a site
- Add a widget
- Remove a site on the site
- Return to the app
- Pull to refresh the site tab
Expected result:
"No site" view is shown Stats widget show "No site" state
Actual result:
Nothing changes in the app, the deleted site is still shown.
Workaround:
Click on the site dropdown. Then the view refreshes and "No site" state is shown on "My site" tab
Hi @staskus, your above description sounds like a bug, primarily affecting the app (not the widget), where pull-to-refresh on the My Site screen doesn't remove the site when the site is deleted. It looks like this should be a separate issue, would you agree?
Hi @staskus, your above description sounds like a bug, primarily affecting the app (not the widget), where pull-to-refresh on the My Site screen doesn't remove the site when the site is deleted. It looks like this should be a separate issue, would you agree?
Hey, @guarani, yes I agree. I'll create a separate issue.
Created a separate issue My Site tab doesn't show "no site" view after deleting the site on the web and refreshing my site tab
Fails | |
---|---|
:no_entry_sign: | Please add a feature label to this issue. e.g. 'Stats' |
Generated by :no_entry_sign: dangerJS