Skip to content

fix: separate initialValue to not cause re-render on updates#2599

Merged
bradenmacdonald merged 1 commit intoopenedx:masterfrom
mitodl:marslan/9100-tinymce-initial-values
Nov 5, 2025
Merged

fix: separate initialValue to not cause re-render on updates#2599
bradenmacdonald merged 1 commit intoopenedx:masterfrom
mitodl:marslan/9100-tinymce-initial-values

Conversation

@marslanabdulrauf
Copy link
Copy Markdown
Contributor

@marslanabdulrauf marslanabdulrauf commented Nov 4, 2025

Description

This PR fixes re-render issue with TinyMCE which cause lost in state and the cursor position

Supporting information

(Internal) https://github.com/mitodl/hq/issues/9100

Short Video: https://github.mit.edu/storage/user/923/files/0c224c31-a86b-4346-a505-e697295d0083

Adding any text in course overview section in Schedule and Details Page causes the cursor to go back to initial point or at the very start of the editor.
This is because we are changing the initialValue of the Editor when we add/update any text which causes re-render.

Referece: https://www.tiny.cloud/docs/tinymce/5/react/#initialvalue

Testing instructions

Steps to Reproduce

  1. Go to Studio Schedule and Details.
  2. Go to Course Overview
  3. Enter text in field

Expected Behavior

Expect to be able to enter text in field

Actual Behavior

When enter text, the cursor pops back to the 1st position in the field at every character.

@openedx-webhooks
Copy link
Copy Markdown

Thanks for the pull request, @marslanabdulrauf!

This repository is currently maintained by @bradenmacdonald.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Nov 4, 2025
@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Nov 4, 2025
@mphilbrick211 mphilbrick211 added the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Nov 4, 2025
@mphilbrick211 mphilbrick211 moved this from Needs Triage to Needs Tests Run or CLA Signed in Contributions Nov 4, 2025
@bradenmacdonald
Copy link
Copy Markdown
Contributor

This seems to be a different take on fixing the same bug as #2437 is trying to fix. I wonder if this fix will be more reliable.

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.82%. Comparing base (36c9eba) to head (b265b17).
⚠️ Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2599      +/-   ##
==========================================
+ Coverage   94.81%   94.82%   +0.01%     
==========================================
  Files        1225     1226       +1     
  Lines       27481    27559      +78     
  Branches     6187     6211      +24     
==========================================
+ Hits        26056    26133      +77     
+ Misses       1367     1355      -12     
- Partials       58       71      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@marslanabdulrauf
Copy link
Copy Markdown
Contributor Author

Hi @bradenmacdonald, just checking in - would you be reviewing this PR?

Copy link
Copy Markdown
Contributor

@bradenmacdonald bradenmacdonald left a comment

Choose a reason for hiding this comment

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

Thanks! This fix is working well for me. I appreciate the comment you added to explain it.

In future, I'd like to refactor this whole thing, because it can really be simplified if we use React Query instead. But for now this seems to be a good fix for the issue.

@bradenmacdonald bradenmacdonald merged commit 1b357cb into openedx:master Nov 5, 2025
9 checks passed
@openedx-webhooks openedx-webhooks removed the needs test run Author's first PR to this repository, awaiting test authorization from Axim label Nov 5, 2025
@github-project-automation github-project-automation Bot moved this from Needs Tests Run or CLA Signed to Done in Contributions Nov 5, 2025
@bradenmacdonald
Copy link
Copy Markdown
Contributor

@marslanabdulrauf could you please backport this to Ulmo?

@marslanabdulrauf
Copy link
Copy Markdown
Contributor Author

@marslanabdulrauf could you please backport this to Ulmo?

yes, here is the backport PR: #2604

Kelketek pushed a commit to open-craft/frontend-app-authoring that referenced this pull request Nov 18, 2025
tecoholic pushed a commit to open-craft/frontend-app-authoring that referenced this pull request Nov 19, 2025
xitij2000 pushed a commit to open-craft/frontend-app-authoring that referenced this pull request Dec 19, 2025
xitij2000 pushed a commit to open-craft/frontend-app-authoring that referenced this pull request Dec 19, 2025
xitij2000 pushed a commit to open-craft/frontend-app-authoring that referenced this pull request Dec 19, 2025
xitij2000 pushed a commit to open-craft/frontend-app-authoring that referenced this pull request Dec 19, 2025
xitij2000 pushed a commit to open-craft/frontend-app-authoring that referenced this pull request Dec 22, 2025
Lunyachek pushed a commit to raccoongang/frontend-app-authoring that referenced this pull request Feb 23, 2026
ihor-romaniuk pushed a commit to raccoongang/frontend-app-authoring that referenced this pull request Feb 26, 2026
jignaciopm pushed a commit to eduNEXT/frontend-app-course-authoring that referenced this pull request Mar 23, 2026
jignaciopm added a commit to eduNEXT/frontend-app-course-authoring that referenced this pull request Mar 24, 2026
fix: broken Course Overview editor on Schedule & Details page (openedx#2599)
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