fix: separate initialValue to not cause re-render on updates#2599
Conversation
|
Thanks for the pull request, @marslanabdulrauf! This repository is currently maintained by 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 approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo 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:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere 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:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
|
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 Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
Hi @bradenmacdonald, just checking in - would you be reviewing this PR? |
bradenmacdonald
left a comment
There was a problem hiding this comment.
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.
|
@marslanabdulrauf could you please backport this to Ulmo? |
yes, here is the backport PR: #2604 |
…x#2599) (#6) Co-authored-by: Muhammad Arslan <[email protected]>
fix: broken Course Overview editor on Schedule & Details page (openedx#2599)
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 DetailsPage 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
Editorwhen we add/update any text which causes re-render.Referece: https://www.tiny.cloud/docs/tinymce/5/react/#initialvalue
Testing instructions
Steps to Reproduce
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.