Skip to content
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

ROAD-539 / Fix debounce of inputs' preview #302

Merged
merged 1 commit into from
Sep 6, 2023

Conversation

arielj
Copy link
Contributor

@arielj arielj commented Sep 5, 2023

Jira Ticket

https://ombulabs.atlassian.net/browse/ROAD-539

Motivation / Context

This PR fixes #250

We have code to debounce the preview, but the code was not really doing a debounce, it was just delaying the requests but still doing all of them (and even doing extra requests since it was triggering the preview of the 2 inputs for any input change (even the title changing)).

This PR moves some things around to keep the debounceTimer in the right scope and to only update the preview of the text area that changed.

QA / Testing Instructions

  • Open a story edit/create form
  • Open dev tools
  • Start typing in the different inputs
  • There should be only a few preview requests (to /stories/render_markdown) a moment after we stop typing instead of a request for each keystroke

I will abide by the code of conduct.

end

expect(page).to have_text("Edit Story")
it "debounces the requests to update the preview to not flood the server" do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

above this line it's the same code as before, I just moved those 2 specs in a preview context, the important change is this last new test

@ABizzinotto ABizzinotto merged commit 96ba4f8 into main Sep 6, 2023
2 checks passed
@ABizzinotto ABizzinotto deleted the ROAD-539-debounce-preview-requests branch September 6, 2023 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Story description preview fires too often
3 participants