Skip to content
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

fix: progressive loading on small screen fixes #1610

Merged
merged 7 commits into from
Mar 8, 2021

Conversation

jenniferarnesen
Copy link
Collaborator

@jenniferarnesen jenniferarnesen commented Mar 8, 2021

Fixed:

  • When initial load is on small screen, all items were loading regardless of whether they were in the loading area buffer zone. With the fix, the ProgressiveLoadingContainer wont be rendered until all the grid layouts (small and large) have been calculated. (problem was that the ProgLoadingContainer was calculating position before the items had finished laying out)
  • After the above point was fixed there was another problem that when switching from portrait->landscape, items that moved into the viewport didn't load, since ProgressiveLoadingContainer only set up a scroll listener. (items get moved up by ReactGridLayout because the grid recalculates the css transform property). To fix this, a MutationObserver was added to observe changes to the style of the grid item (assumption is that it is the transform property that is updated. Other possible style changes are width and height. Either of those changing would also suggest that the item had moved). This also fixes a pre-existing bug in Edit mode where, if you delete items and unloaded items from below on the dashboard move up into the viewport, they didn't get loaded. Note that the observer is only observing for unloaded items.

Before: Small screen - portrait->landscape - notice that all items are already loaded

sm.sc.loading.before.mov

After: small screen portrait->landscape - progressive loading works

sm.sc.loading.after.mov

Before: edit mode - unloaded items don't load when moved into viewport (as items above it are deleted)

prog.loading.edit.mode.before.mov

After: edit mode - unloaded items load when moved into viewport

prog.loading.edit.mode.after.mov

@jenniferarnesen jenniferarnesen requested review from amcgee and martinkrulltott and removed request for amcgee March 8, 2021 10:04
@jenniferarnesen jenniferarnesen enabled auto-merge (squash) March 8, 2021 14:12
@jenniferarnesen jenniferarnesen merged commit cd19ea5 into master Mar 8, 2021
@jenniferarnesen jenniferarnesen deleted the fix/progressive-load-on-sm-screen branch March 8, 2021 14:15
dhis2-bot added a commit that referenced this pull request Mar 8, 2021
## [31.13.6](v31.13.5...v31.13.6) (2021-03-08)

### Bug Fixes

* DashboardsBar onExpandedChanged must be a function ([#1613](#1613)) ([0bc1820](0bc1820))
* progressive loading on small screen fixes ([#1610](#1610)) ([cd19ea5](cd19ea5))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 31.13.6 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants