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

Include swiper version in CSS file name, for cache busting #4685

Merged
merged 1 commit into from
Feb 19, 2024

Conversation

absidue
Copy link
Member

@absidue absidue commented Feb 17, 2024

Include swiper version in CSS file name, for cache busting

Pull Request Type

  • Bugfix

Description

As swiper components get their own shadow DOM, they don't have access to any CSS in the main DOM, so we need to inject the necessary CSS into that shadow DOM. To avoid the FreeTube styles unintentionally conflicting with swiper's and breaking things, we create a separate CSS file at build time with only the swiper CSS inside it.

Currently that file gets the name swiper.css, which works fine but means it stays indentical regardless of which swiper version we are using, which could result in Electron assuming that the file is the same because the file name isn't the same and using the one from it's cache (for the main CSS file webpack adds the hash of the content to the filename). To solve that potential issue, this pull request adds the swiper version to the file name e.g. swiper-11.0.6.css. In this context using the version is okay, because the CSS is inside the Swiper dependency and we don't do any modifications to it on our side, so the only time the CSS would change is because of a swiper update.

Screenshots

swiper-css-network-request

Testing

  1. Open the devtools
  2. Switch to the network tab
  3. Set the filter to CSS
  4. Visit a channel with gallery community posts e.g. https://www.youtube.com/@MrBeast/community
  5. Check that the network log shows a similar entry to the one in the screenshot above
  6. Check that the image slider looks the same as before this pull request.

Desktop

  • OS: Windows
  • OS Version: 10
  • FreeTube version: 0.19.1

@FreeTubeBot FreeTubeBot enabled auto-merge (squash) February 17, 2024 11:24
@github-actions github-actions bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label Feb 17, 2024
@FreeTubeBot FreeTubeBot merged commit 161633d into FreeTubeApp:development Feb 19, 2024
5 checks passed
@github-actions github-actions bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label Feb 19, 2024
@absidue absidue deleted the swiper-css-version branch February 19, 2024 11:04
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Feb 22, 2024
…n-one-user-playlist-2

* fix/temp/api-ver: (37 commits)
  workaround
  Hide date and views separator on the watch page when views are hidden (FreeTubeApp#4697)
  Translated using Weblate (Ukrainian)
  Translated using Weblate (Polish)
  Translated using Weblate (Estonian)
  Bump webpack from 5.90.1 to 5.90.3 (FreeTubeApp#4696)
  Bump sass from 1.70.0 to 1.71.0 (FreeTubeApp#4693)
  Bump electron from 28.2.2 to 28.2.3 (FreeTubeApp#4692)
  Bump the stylelint group with 1 update (FreeTubeApp#4691)
  Remove unused isLoading from ft-community-post (FreeTubeApp#4684)
  Include swiper version in CSS file name, for cache busting (FreeTubeApp#4685)
  Translated using Weblate (Chinese (Traditional))
  Fix local API erroring when the view count is missing on the channel shorts tab (FreeTubeApp#4689)
  Translated using Weblate (Croatian)
  Translated using Weblate (Polish)
  Fix Hungarian Locale Name (FreeTubeApp#4686)
  Translated using Weblate (Dutch)
  Translated using Weblate (French)
  Translated using Weblate (Spanish)
  Bump marked from 11.2.0 to 12.0.0 (FreeTubeApp#4638)
  ...
PikachuEXE added a commit to PikachuEXE/FreeTube that referenced this pull request Feb 22, 2024
…-user-playlist-2

* development: (37 commits)
  Fix local API search erroring, because the default parameter values were not getting applied (FreeTubeApp#4704)
  Hide date and views separator on the watch page when views are hidden (FreeTubeApp#4697)
  Translated using Weblate (Ukrainian)
  Translated using Weblate (Polish)
  Translated using Weblate (Estonian)
  Bump webpack from 5.90.1 to 5.90.3 (FreeTubeApp#4696)
  Bump sass from 1.70.0 to 1.71.0 (FreeTubeApp#4693)
  Bump electron from 28.2.2 to 28.2.3 (FreeTubeApp#4692)
  Bump the stylelint group with 1 update (FreeTubeApp#4691)
  Remove unused isLoading from ft-community-post (FreeTubeApp#4684)
  Include swiper version in CSS file name, for cache busting (FreeTubeApp#4685)
  Translated using Weblate (Chinese (Traditional))
  Fix local API erroring when the view count is missing on the channel shorts tab (FreeTubeApp#4689)
  Translated using Weblate (Croatian)
  Translated using Weblate (Polish)
  Fix Hungarian Locale Name (FreeTubeApp#4686)
  Translated using Weblate (Dutch)
  Translated using Weblate (French)
  Translated using Weblate (Spanish)
  Bump marked from 11.2.0 to 12.0.0 (FreeTubeApp#4638)
  ...
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.

5 participants