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

(PC-33007) chore(web): remove service worker #7274

Merged
merged 2 commits into from
Nov 28, 2024

Conversation

cgerrard-pass
Copy link
Contributor

Link to JIRA ticket: https://passculture.atlassian.net/browse/PC-33007

Flakiness

If I had to re-run tests in the CI due to flakiness, I add the incident on Notion

Checklist

I have:

  • Made sure my feature is working on web.
  • Made sure my feature is working on mobile (depending on relevance : real or virtual devices)
  • Written unit tests native (and web when implementation is different) for my feature.
  • Added a screenshot for UI tickets or deleted the screenshot section if no UI change
  • If my PR is a bugfix, I add the link of the "résolution de problème sur le bug" on Notion
  • I am aware of all the best practices and respected them.

Screenshots

delete if no UI change

Platform Mockup/Before After
iOS
Android
Phone - Chrome
Desktop - Chrome

Best Practices

Click to expand
  • Remove non-null assertion operators (just like other type assertions, this doesn’t change the runtime behavior of your code, so it’s important to only use ! when you know that the value can’t be null or undefined).

Test specific:

  • When you see a local variable that is over-written in every test, mock it.
  • Prefer user to fireEvent.

@cgerrard-pass cgerrard-pass requested review from a team as code owners November 25, 2024 10:31
Copy link
Contributor

@bebstein-pass bebstein-pass left a comment

Choose a reason for hiding this comment

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

il me semble qu'on avait déjà tenté de supprimer le service worker et qu'on avait du des soucis lors du déploiement / mise à jour en prod, si mes souvenirs sont bons, on avait du rollback pour corriger rapidement

il faudra etre particulièrement vigilant lors de la mise en prod que coté web tout ce passe bien

@@ -111,7 +111,6 @@
media="(device-width: 1024px) and (device-height: 1366px) and (-webkit-device-pixel-ratio: 2)"
rel="apple-touch-startup-image"
/>
<link rel="manifest" href="<%- PUBLIC_URL %>/manifest.json" />
Copy link
Contributor

Choose a reason for hiding this comment

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

c'est dommage, on ne pourra plus l'installer la version web sur l'écran d'accueil

est-ce qu'il y a un moyen facile de supprimer le service worker tout en gardant le manifest.json ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

T'avais reussi à faire marche l'installation de la version web sur l'écran accueil? Perso j'y suis jamais arrivé donc je sais pas si ça marchait

Copy link
Contributor

Choose a reason for hiding this comment

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

je viens de le faire à l'instant avec Firefox sur Android

Copy link
Contributor Author

Choose a reason for hiding this comment

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

J'ai retiré cette ligne parceque j'avais cette erreur dans un build local:
Access to manifest at 'https://passculture.app/manifest.json' from origin 'http://localhost:4173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Mais peut être que je peux laisser la ligne?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Après on est d'accord que le manifest n'apporte pas grand chose si on a plus le SW?

Copy link
Contributor

Choose a reason for hiding this comment

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

de ce que j'en avais compris, avoir le manifest permet d'avoir le bouton permettant d'installer la web app sur l'écran d'accueil

le service worker, permet de gérer le cache des requetes (et donc l'offline)

il y a des PWA installable qui ne fonctionnent que si on est connecté, je ne sais pas si elles ont un service worker (j'imagine que non)

Copy link
Contributor

Choose a reason for hiding this comment

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

Je confirme qu'on peut avoir le manifest sans pour autant installer le service worker, qui lui doit être lancé via le JS.
Au pire, il est peut-être plus simple dans un premier temps de faire des appels "vides" des fonctions qui existent et qui sont appelées par le SW ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

C'est bizarre, je n'arrive plus a reproduire l'erreur CORS que j'avais en build local. Je restaure le manifest.json du coup

src/libs/environment/env.web.ts Outdated Show resolved Hide resolved
@cgerrard-pass cgerrard-pass force-pushed the PC-33007-remove-service-worker branch 3 times, most recently from 9334373 to 59816d8 Compare November 25, 2024 17:55
Copy link

sonarcloud bot commented Nov 27, 2024

Copy link

sonarcloud bot commented Nov 27, 2024

@cgerrard-pass cgerrard-pass merged commit fda0fbd into master Nov 28, 2024
53 checks passed
@cgerrard-pass cgerrard-pass deleted the PC-33007-remove-service-worker branch November 28, 2024 09:55
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