question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rich text crashes when clicked multiple times in a row

See original GitHub issue

Category

[ ] Enhancement [x] Bug [ ] Question

Version

Please specify what version of the library you are using: [3.5.0]

Expected / Desired Behavior / Question

Nothing happens.

Observed Behavior

The application crashes (react crashes), with message:

Uncaught Invariant Violation: Maximum update depth exceeded. 
This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. 
React limits the number of nested updates to prevent infinite loops.

Crashes here, at the row 867, this.setState: https://github.com/pnp/sp-dev-fx-controls-react/blob/2f2839739fbd6337fa171cab88afc67e1b434f53/src/controls/richText/RichText.tsx#L854-L873

Steps to Reproduce

Quickly (milliseconds) click in the RichText text control several times, like five or so (using left mouse button). The rich text should not be empty (should contain some formatted text, such as a hyperlink)

It looks like the handler just enters the infinite loop, maybe a safeguard around it could solve it.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nbelyhcommented, Jan 29, 2022

@joelfmrodrigues unfortunately I am not sure how to fix this properly… 😢 The issue looks a bit complicated for me. There were already several attempts to fix the core thing as far as I understand (linked issue), i.e. the <ReactQuill value={....}> thing. There are even comments in the code related to it 😄 For myself, I just went for the workaround of replacing the value={} with defaultValue={} thing and updating the text manually in my code in onChange event. But this won’t work in general case, described in the linked issue. I mean here: https://github.com/pnp/sp-dev-fx-controls-react/blob/2f2839739fbd6337fa171cab88afc67e1b434f53/src/controls/richText/RichText.tsx#L630

This comment is a sad truth. Unfortunately, if you replace value with defaultValue, you’ll get the “evil” issue 666 come back again. I’ve decided just to live with that one for now… waiting for a hero 😄 I would say the author of that comment may be a decent candidate 😄

I could revert the fix for 666, I think having 666 is better than infinite loop and app crash anyway? I would probably ask @AJIXuMuK to look at this when he has time, since he already dealt with this thing?

0reactions
AJIXuMuKcommented, Feb 12, 2022

I will look at it for sure. Little business: find appropriate block of time 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rich Text Edit Crashes without any reasons
The Rich Text Edit just crashes without any messages at any time. It can run for seconds or hours. It is not determined....
Read more >
Crash/freeze after adding a Text: Rich filter - Shotcut Forum
You can go to View and click on Application Log… That is good advice. However, if Shotcut crashes and you reopen it to...
Read more >
How to Stop Word from Crashing! - 24 Hour Company
2) Minimize Use of Text Boxes. The biggest concern I have with text boxes has less to do with crashing and more to...
Read more >
Microsoft Word crashes: Recovery options
The days of complex Word documents crashing regularly are a thing of ... crashes, try saving the document as a Rich Text Format...
Read more >
Deleting a table row containing text crashes InDesign
I can replicate the issue every single time across multiple documents. The current workaround for me is to delete all the content in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found