Skip to content

Add guard clause to insertMarkdownText

Paul Slaughter requested to merge ps-guard-on-insert-markdown-text into master

What does this MR do and why?

This MR adds a performance improvement and resiliency to insertMarkdownText. We can short circuit and return early if we don't actually have anything to insert (this happens in the attach-file toolbar button is pressed).

Screenshots or screen recordings

This bug is also being fixed in !145034 (merged), but this bit of code also fixes it:

Before After
bug_attach_file_delete fix_attach_file_delete

The following screenshots show that existing behavior still works:

List continuation Source markdown editor Comment markdown editor
Screenshot_2024-02-16_at_1.47.52_PM Screenshot_2024-02-16_at_1.49.49_PM Screenshot_2024-02-16_at_1.51.14_PM

How to set up and validate locally

If !145034 (merged) is not merged yet:

  1. Start GDK.
  2. In an issue comment click the "Attach file" button.
  3. The cursor should not move.

Otherwise:

  1. Start GDK
  2. Use the markdown editor in an issue comment to ensure that the toolbar buttons still work as expected.
  3. Use the source code markdown editor to update a README.md file. Ensure that the toolbar buttons still work as expected.

Thanks

Thanks to @leipert and @john-slaughter for pairing with me here 🎉

https://youtu.be/dSAo-wtNjDg?feature=shared

Edited by Paul Slaughter

Merge request reports