Skip to content

Playground: Throttle URL updates to avoid replaceState limit - #2013

Merged
marcoroth merged 1 commit into
mainfrom
playground-url-update-throttling
Aug 5, 2026
Merged

marcoroth merged 1 commit into
mainfrom
playground-url-update-throttling

Conversation

@marcoroth

Copy link
Copy Markdown
Owner

This pull request updates the playground to throttle its URL updates so that typing quickly in the editor no longer trips the browser's history.replaceState() rate limit.

Every keystroke called four separate URL writers. Each of them built its own URL and unconditionally called window.parent.history.replaceState(), even when the search params were already identical to what was in the URL. That adds up to four replaceState() calls per keystroke, so Safari's limit of 100 calls per 10 seconds is reached after roughly 25 characters of fast typing:

Unhandled Promise Rejection: SecurityError: Attempt to use history.replaceState() more than 100 times per 10 seconds

Because the SecurityError is thrown from inside updateURL(), which is the first thing analyze() does, the rejection aborts the whole analysis and the playground stops responding to further input.

@github-actions

github-actions Bot commented Aug 5, 2026 •

Copy link
Copy Markdown

🌿 Interactive Playground and Documentation Preview

A preview deployment has been built for this pull request. Try out the changes live in the interactive playground:


🌱 Grown from commit 7a8676c


✅ Preview deployment has been cleaned up.

@pkg-pr-new

pkg-pr-new Bot commented Aug 5, 2026

Copy link
Copy Markdown
npx https://pkg.pr.new/@herb-tools/formatter@2013
npx https://pkg.pr.new/@herb-tools/language-server@2013
npx https://pkg.pr.new/@herb-tools/linter@2013

commit: 7a8676c

@marcoroth
marcoroth marked this pull request as ready for review August 5, 2026 11:54
@marcoroth
marcoroth merged commit 516a58e into main Aug 5, 2026
22 checks passed
@marcoroth
marcoroth deleted the playground-url-update-throttling branch August 5, 2026 11:54

This branch was successfully deployed

1 active deployment
herb-tools (Preview) — 7a8676c6 Deployed Aug 5, 2026 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

playground The Herb playground web app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant