Skip to content

Fix event lag never finishing when options change after load - #559

Merged
CodeByZach merged 2 commits into
masterfrom
fix-eventlag-settings
Nov 5, 2026
Merged

CodeByZach merged 2 commits into
masterfrom
fix-eventlag-settings

Conversation

@CodeByZach

Copy link
Copy Markdown
Owner

The event-lag collector read its settings from the global options on every tick, so Pace.start({ eventLag: false }) after loading pace with a bundler left the bar running forever. It now keeps the settings it was created with. The README's bundler example, which passed options to Pace.start() that don't apply to the page load, now shows setting window.paceOptions in a module imported first (or, with RequireJS, in a script before require()).

How to verify: npm test. The new test "finishes when Pace.start() turns off eventLag" fails on master and passes here.

The event-lag collector read its settings from the global options on
every tick. When those options changed after it was created, for
example with Pace.start({ eventLag: false }) after loading pace with a
bundler, it read them from `false` and never finished, so the bar
never finished either.

It now uses the settings it was created with, like the elements
collector. Changing individual settings at runtime
(Pace.options.eventLag.lagThreshold = 30) still applies.
The example passed `document: false` to Pace.start(), but pace builds
its collectors when it loads, so the option didn't apply to the page
load. Show setting window.paceOptions in a module imported before pace
instead, or with RequireJS, in a script before require().
@CodeByZach CodeByZach self-assigned this Nov 5, 2026
This was referenced Nov 5, 2026
@CodeByZach
CodeByZach merged commit 50bd309 into master Nov 5, 2026
2 checks passed
@CodeByZach
CodeByZach deleted the fix-eventlag-settings branch November 5, 2026 20:34
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.

1 participant