Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Site Selector: show placeholder only when site list is not available …
…at all Fixes a bug where `SiteSelector` would show a placeholder instead of list of visible sites, even when the sites list data are available. The `isRequestingMissingSites` selector returns `true` when there is an outstanding request for the sites data and the local data are detected as not-fresh, i.e., the local site count is different from the server site count, as revealed by the `user.site_count` property. In such a case, a placeholder is shown instead of showing the available local list. This is a regression introduced in #13094, when `sites-list` was removed from the component. The condition to show the placeholder used to be `! sites.initialized`, which is much weaker than `isRequestingMissingSites`. The `sites-list` could be initialized from local storage data and be requesting an update from the server, without affecting the `initialized` flag. This patch replaces the `isRequestingMissingSites` selector with `hasLoadedSites`, which is more appropriate here. It also fixes the `disabled` condition for the `Search` component. It used to be `! this.props.sites`, but `this.props.sites` is always truthy, because the `getSites` selector returns an empty object when there are no site data. This could happen when the sites list data were detected as not-fresh
- Loading branch information