Skip to content

Conversation

dobromir-hristov
Copy link
Contributor

@dobromir-hristov dobromir-hristov commented Apr 25, 2023

Bug/issue #, if applicable: 108379797

Summary

Changes the TabNav content rendering to be v-show based, so images can be pre-loaded and wont flash when changing tabs.

Dependencies

NA

Testing

  1. Load an archive with a tabnav that has mostly images
  2. Assert images no longer flash when changing active tab

Checklist

Make sure you check off the following items. If they cannot be completed, provide a reason.

  • Added tests
  • Ran npm test, and it succeeded
  • Updated documentation if necessary

@mportiz08
Copy link
Contributor

Not opposed to switching to a v-show based approach as long as we've done some performance testing of realistic scenarios to make sure that there's no major regression with loading everything up-front.

@dobromir-hristov
Copy link
Contributor Author

Played a bit with tabnavs with lots of images found a few things. Behaviour is consistent across browsers, which is great.

We explicitly set that images under the tabnav component should be eager loaded, so it downloads all images, rendered or not. This can deff cause slowdown on slower/limited networks.
Before this PR, it was not an issue, because the images are not rendered at all, compared to being hidden now.

If we however change the imageLoadingStrategy that back to lazy, browsers only load the images you can see. As you change the active tab, it starts downloading the ones on the new active tab.

@dobromir-hristov dobromir-hristov marked this pull request as ready for review April 27, 2023 09:14
@dobromir-hristov
Copy link
Contributor Author

@swift-ci test

Copy link
Contributor

@hqhhuang hqhhuang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@dobromir-hristov
Copy link
Contributor Author

@swift-ci test

@hqhhuang
Copy link
Contributor

@swift-ci test

@hqhhuang hqhhuang merged commit adadcb3 into swiftlang:main Apr 28, 2023
@hqhhuang hqhhuang deleted the dhristov/r108379797-tab-nav-rendering-refactor branch April 28, 2023 20:55
hqhhuang added a commit to hqhhuang/swift-docc-render that referenced this pull request Apr 28, 2023
…//108379797

* refactor: change the tab-nav rendering rdar://108379797

* chore: add tests and cleanup

---------

Co-authored-by: Hanqing Huang <87735557+hqhhuang@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants