-
Notifications
You must be signed in to change notification settings - Fork 27
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
🐛✨ [Frontend] Automatically pull latest frontend version (nocache) #7054
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7054 +/- ##
=======================================
Coverage 87.57% 87.57%
=======================================
Files 1629 1629
Lines 63454 63454
Branches 2047 2047
=======================================
Hits 55569 55569
Misses 7549 7549
Partials 336 336
*This pull request uses carry forward flags. Click here to find out more.
Continue to review full report in Codecov by Sentry.
|
Quality Gate passedIssues Measures |
💪 |
print(f"Updating vcs_ref_client: {index_file_path}") | ||
file.write(data) | ||
|
||
boot_file_paths = _get_output_file_paths("boot.js") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIP: if you would instead use pathlib.Path
, your code would become more compact
from pathlib import Path
boot_file_paths: list[Path] = [] # assume we have this
for boot_file_path in boot_file_paths:
if boot_file_path.is_file():
print(f"Updating URL_PARAMETERS: {boot_file_path}")
boot_file_path.write_text(
boot_file_path.read_text().replace(
"addNoCacheParam : false",
"addNoCacheParam : true",
)
)
and the same with all the operations to compose paths.
What do these changes do?
There is currently a mechanism in place to detect whether the webserver has a different version of frontend compared to the one the user's browser has. If that's the case a "Reload" button, that requests the newest version, is shown to the users.
In order to figure out that the user's browser is actually using a cached (different) version, we compare the
vcsRefClient
stamped in a configuration file (that can be cached) and thevcsRefClient
that is included in the response to the/app-summary
resource (which is NOT cached).When the user hits the oSparc's "Reload" button, what oSparc does is add a random query parameter to the cacheable resources, forcing the browser to pull the latest version.
But when the user hits browser's reload button, the old-cached version might be loaded, hence the oSparc's Reload button would show up again, bringing the user to an endless loop:
In the animation:
no-cache=random_number
query parameter and force the pull of the newest version (2)In this PR, the application loading pieces were tuned after compilation, making this random query parameter always be present.
Related issue/s
closes #6697
How to test
Dev-ops checklist