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

refactor: Only debounce REPL runner on user input #1160

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

rschristian
Copy link
Member

@rschristian rschristian commented Jul 1, 2024

Closes #1159

Instead of debouncing the REPL runner by 500ms across the board, limit it to user interaction. This lets us switch examples in the REPL or pages in the tutorial faster -- the former is especially relevant, as dynamically pulling modules from esm.sh means there often will be a delay anyhow. Decreasing the baseline delay is therefore quite useful to make the editor seem faster & more fluid.

useEffect(() => {
const delay = setTimeout(() => {
setRunnerCode(editorCode);
}, 250);
Copy link
Member Author

@rschristian rschristian Jul 1, 2024

Choose a reason for hiding this comment

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

Happy to revert, but 250ms felt a bit better? This only affects the REPL runner pane, not the editor itself, so it won't display errors that get in the user's way while they're typing.

Just a bit more responsive for simple edits is all.

@rschristian rschristian merged commit aeb46af into master Jul 1, 2024
5 checks passed
@rschristian rschristian deleted the refactor/repl-runner-timeout branch July 1, 2024 23:44
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.

Limit runner delay to user input
2 participants