Skip to content

Conversation

@Krakabek
Copy link
Collaborator

Closes #26

💸 TL;DR

Throttle might be not the best strategy for live code editor, since the code is usually not valid during the code modifications, but is valid after they are done
Debounce allows to write code without triggering the re-render (and a potential endless loop or complication error)

🧪 Testing Steps / Validation

Tested locally

I encourage the reviewers to check out the branch, play with the editor and compare experience with the current prod

✅ Checks

  • CI tests (if present) are passing
  • Adheres to code style for repo
  • Contributor License Agreement (CLA) completed if not a Reddit employee

@Krakabek Krakabek requested a review from niedzielski July 16, 2024 10:23
@Krakabek Krakabek self-assigned this Jul 16, 2024

/** Throttled changes after updating sources. */
#setSrcSideEffects = throttle((save: boolean): void => {
#setSrcSideEffects = debounce((save: boolean): void => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't tried this but trust your judgement 👍 the intent of the original design was to give regular feedback as fast as possible.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The rollback would be easy in case we hate it, let's give it a try

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add debounce for live reload

2 participants