Skip to content

fix: error on course outline in Studio due to browser caching old JS file [FC-0009]#33015

Merged
connorhaugh merged 1 commit intoopenedx:masterfrom
open-craft:braden/copy-paste-template-error-fix
Aug 15, 2023
Merged

fix: error on course outline in Studio due to browser caching old JS file [FC-0009]#33015
connorhaugh merged 1 commit intoopenedx:masterfrom
open-craft:braden/copy-paste-template-error-fix

Conversation

@bradenmacdonald
Copy link
Contributor

@bradenmacdonald bradenmacdonald commented Aug 15, 2023

Description

This is a follow-up to #32891

This fixes a bug where some users would see an error that prevented the course outline page in Studio from loading, for any course:

VM409:222 Uncaught ReferenceError: enableCopyPasteUnits is not defined
    at child.eval (eval at _.template (cms-base-vendor.7fdf2ee29320.js:12214:20), <anonymous>:222:2)
    at child.template (cms-base-vendor.7fdf2ee29320.js:12221:21)
    at child.renderTemplate (outline.js:1670:29)
    at child.render (outline.js:1647:18)
    at child.render (outline.js:7172:67)
    at child.<anonymous> (outline.js:768:17)
    at executeBound (cms-base-vendor.7fdf2ee29320.js:11461:67)
    at child.bound [as render] (cms-base-vendor.7fdf2ee29320.js:11493:14)
    at outline.js:1724:38
    at _.each._.forEach (cms-base-vendor.7fdf2ee29320.js:10913:9)

Reason: When viewing a course outline on edx.org, the templates like course_outline.underscore (which expects enableCopyPasteUnits to be defined) are embedded directly into the HTML on the server side, so users were definitely getting the latest version of the template which expects that variable to be defined. But the JS view code which renders the template and provides the context (hopefully including enableCopyPasteUnits) is bundled into the file https://studio.edx.org/static/studio/js/factories/outline.js which as you can see is not a versioned URL, unlike many other JS static assets. Some users saw the page with an old (cached) version of the view code, but the new template, resulting in this error.

Simply refreshing the page should also solve the bug, but we are implementing this fix anyways to reduce the impact even further so hopefully nobody else will encounter the error at all, regardless of their cache.

Supporting information

n/a

Testing instructions

Try accessing a course in Studio without the contentstore.enable_copy_paste_units waffle flag defined at all, and also with it set to True.

Deadline

ASAP - CAT-1 issue, although there is a workaround in place and it doesn't seem to be ongoing.

Other information

@bradenmacdonald bradenmacdonald changed the title fix: error on course outline in Studio due to browser caching old JS file fix: error on course outline in Studio due to browser caching old JS file [FC-0009] Aug 15, 2023
@bradenmacdonald bradenmacdonald added the FC Relates to an Axim Funded Contribution project label Aug 15, 2023
@connorhaugh connorhaugh merged commit b8713fa into openedx:master Aug 15, 2023
@bradenmacdonald bradenmacdonald deleted the braden/copy-paste-template-error-fix branch August 15, 2023 18:43
@openedx-webhooks
Copy link

Thanks for the pull request, @bradenmacdonald! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U FC Relates to an Axim Funded Contribution project and removed FC Relates to an Axim Funded Contribution project labels Aug 15, 2023
@openedx-webhooks
Copy link

@bradenmacdonald 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

@openedx-webhooks openedx-webhooks removed the FC Relates to an Axim Funded Contribution project label Aug 15, 2023
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

mehedikhan72 pushed a commit to mehedikhan72/edx-platform that referenced this pull request Aug 24, 2023
…file (openedx#33015)

This fixes a bug where some users would see an error that prevented the course outline page in Studio from loading, for any course.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants