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

[5.0] [JIRA-262] Robust HTML update checking. #2086

Merged
merged 10 commits into from
Jan 8, 2020

Conversation

revanth0212
Copy link
Contributor

Description

Robust HTML update checking using Node HTML Parser.

The issue with current HTML checking is, it is a simple byte to byte comparison. Even if there is a change to an unrelated part of the HTML file that does not affect the App, SW will send a message to UI to show the update toast.

With this change, we can define what the comparison checker needs to compare to deduce if an update is needed.

As of now, this checker tracks, style, link, script and title tags along with data-media-backend and data-image-optimizing-origin attributes of thehtml tag.

We can add new validation functions as we go along.

This approach uses node-html-parser which adds 28KB to the bundle size before zipping.

Related Issue

Closes JIRA-262

Verification Steps

Can only be tested in local.

  1. Run yarn build && yarn stage:venia
  2. Go to the deployed webpage and refresh a couple times to make sure the SW is installed.
  3. Go to the build directory, venia-concept/dist/index.html and change title or data-media-backend or any style.
  4. Refresh the deployed web page. You should see the update toast.
  5. Go back to the index.html file and change any entity that is not tracked, like meta tag.
  6. Repeat step 4 and you should not see any update toast.

Checklist

  • Should not cause any issues in development mode. Ie. yarn watch:venia.

@revanth0212 revanth0212 added the version: Minor This changeset includes functionality added in a backwards compatible manner. label Jan 8, 2020
@PWAStudioBot
Copy link
Contributor

Messages
📖

Access a deployed version of this PR here. Make sure to wait for the "pwa-pull-request-deploy" job to complete.

📖 DangerCI Failures related to missing labels/description/linked issues/etc will persist until the next push or next nightly build run (assuming they are fixed).
📖

Associated JIRA tickets: JIRA-262.

Generated by 🚫 dangerJS against bd35bd6

@dpatil-magento
Copy link
Contributor

dpatil-magento commented Jan 8, 2020

@supernova-at Need your approval on this. Its copy of #2059 but base branch is release/5.0.

@dpatil-magento dpatil-magento merged commit 983de13 into release/5.0 Jan 8, 2020
@dpatil-magento dpatil-magento deleted the revanth/release5.0_sw_html_update_fix branch January 8, 2020 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg:venia-concept version: Minor This changeset includes functionality added in a backwards compatible manner.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants