FEATURE: Add diff streaming animation #1355
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🔍 Overview
Previously we attempted to add a diff streaming animation to the AI composer helper: #1332, but it resulted in issues despite attempted fixes (#1338) so we temporarily suppressed the diff animation (#1341).
This update makes a second attempt at implementing the diff streaming animation. Instead of creating a custom diff algorithm, we make use of a third-party library
jsDiff
(which we added to core here: discourse/discourse#32833). While streaming, the diff animation often struggles with markdown links and images, so we make use ofmarkdown-it
parser to detect those cases and prevent breaking the animation.📹 Preview
working.mov