-
Notifications
You must be signed in to change notification settings - Fork 74
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
Fix having tutorials update if text is deleted. #827
Conversation
Tutorials should rerun whenever the contents change. Some code designed to perform updates when separate code blocks were edited happened to prevent deleting text from triggering the update.
8b24240
to
5f25375
Compare
@@ -192,8 +192,8 @@ function process_block_debounce(selector, debounce) { | |||
processBlockInfo.lastelem = selector; | |||
if (!debounce) { | |||
process_block(selector); | |||
return; | |||
} |
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.
@manthey could you explain why this change? Looking at the code it is not exactly clear to me.
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.
When a text area is altered, we want to rerun the tutorial, but we want to debounce it so it doesn't rerun too often (to give you a chance to finish typing). We trigger this on textarea change
, input
, and propertychange
events (and resetting a field). The specific bug that this fixes is when no editing has been done, and you click on a text area and just delete a character. In this case, because the area had not been the most recently altered, it enters this code path. However, since we are trying to debounce, instead of processing the block, it should fall through and set a timer to run after debouncing. But, the return
was in the wrong place, and it never set the timer. If you clicked on another text area, or typed more, then this branch (from line 188) wasn't entered, and the tutorial would update. The return
should only apply if we aren't debouncing and are processing the block immediately.
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.
okay, thanks for the detailed explanation, it makes sense to me now.
- aashish
Tutorials should rerun whenever the contents change. Some code designed to perform updates when separate code blocks were edited happened to prevent deleting text from triggering the update.