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

[website] Add no-op service worker to fix stale cache issue #37607

Merged
merged 4 commits into from
Jul 3, 2023

Conversation

cherniavskii
Copy link
Member

Fixes #36808
Same as mui/mui-x#8598, but for the Core docs.
It fixed the issue for MUI X docs, here's the feedback from the team:

Apart from the problem described in #36808, there are a few more reasons to fix this issue:

  1. https://mui.com/careers/ is also impacted by the caching issue, which results in closed roles being presented as open and vice versa. I got a confirmation from one of the candidates experiencing this.
  2. We are updating our pricing page (see [website] Add perpetual option to pricing page #35504). If the caching issue persists, we'll end up showing outdated pricing for some users.

@cherniavskii cherniavskii added the website Pages that are not documentation-related, marketing-focused. label Jun 16, 2023
@mui-bot
Copy link

mui-bot commented Jun 16, 2023

Netlify deploy preview

https://deploy-preview-37607--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against 6099db7

process.env.NODE_ENV === 'production' &&
window.location.host.indexOf('mui.com') !== -1
) {
if ('serviceWorker' in navigator && process.env.NODE_ENV === 'production') {
Copy link
Member Author

Choose a reason for hiding this comment

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

This change is here only for demonstration purposes in deploy preview, I'll revert it before merging

@cherniavskii cherniavskii marked this pull request as ready for review June 16, 2023 15:10
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

This looks good, I was about to propose removing this logic end of 2024, but actually reloading all the other tabs when a new version is released can make sense as a logic to keep. It's a bit annoying to lose page states, but this would especially be interesting if we expose an API to improve smooth releases (API backward compatibility issues between versions). This logic wouldn't be enough but maybe still helps. We could consider https://developer.mozilla.org/en-US/docs/Web/API/Broadcast_Channel_API as well but probably a bit more flaky (sw have this built-in)

@oliviertassinari oliviertassinari added the scope: docs-infra Specific to the docs-infra product label Jun 17, 2023
Copy link
Member

@Janpot Janpot left a comment

Choose a reason for hiding this comment

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

Bringing this to Toolpad as well mui/mui-toolpad#2190

@michaldudak
Copy link
Member

@cherniavskii is it ok to merge this?

@cherniavskii
Copy link
Member Author

@michaldudak Yes, it's ready to be merged now 👍

@cherniavskii cherniavskii merged commit cdf8dab into mui:master Jul 3, 2023
18 checks passed
@cherniavskii cherniavskii deleted the fix-docs-caching-issue branch July 3, 2023 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: docs-infra Specific to the docs-infra product website Pages that are not documentation-related, marketing-focused.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[docs-infra] Stale service-worker cache issue
5 participants