Create a unique event-clock for each Preact instance on a page.#5068
Open
JoviDeCroock wants to merge 4 commits intov10.xfrom
Open
Create a unique event-clock for each Preact instance on a page.#5068JoviDeCroock wants to merge 4 commits intov10.xfrom
JoviDeCroock wants to merge 4 commits intov10.xfrom
Conversation
If a library bundles its own variant of Preact and relies on event-bubbling to step through its root and into other roots. Think a custom-element component library bubbling up into your regular application. Then the event-clock can be out of sync meaning that events aren't firing on the root application. Theoretically this can't reproduce the bug of shifting roots as the first touch-point into the new Preact root will re-create with its own root.
📊 Tachometer Benchmark ResultsSummaryduration
usedJSHeapSize
Resultscreate10kduration
usedJSHeapSize
filter-listduration
usedJSHeapSize
hydrate1kduration
usedJSHeapSize
many-updatesduration
usedJSHeapSize
replace1kduration
usedJSHeapSize
run-warmup-0
run-warmup-1
run-warmup-2
run-warmup-3
run-warmup-4
run-final
text-updateduration
usedJSHeapSize
tododuration
usedJSHeapSize
update10th1kduration
usedJSHeapSize
|
|
Size Change: +202 B (+0.26%) Total Size: 79 kB 📦 View Changed
ℹ️ View Unchanged
|
rschristian
approved these changes
Mar 30, 2026
5673284 to
127236e
Compare
marvinhagemeister
approved these changes
Mar 31, 2026
JoviDeCroock
commented
Mar 31, 2026
developit
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a library bundles its own variant of Preact and relies on event-bubbling to step through its root and into other roots. Think a custom-element component library bubbling up into your regular application. Then the event-clock can be out of sync meaning that events aren't firing on the root application.
Theoretically this can't reproduce the bug of shifting roots as the first touch-point into the new Preact root will re-create with its own root.
We eliminate the bug from deliberate multi-bundle applications but it would now be introduced in ones where the user accidentally does a dual package hazard combination, that however would also have issues with the options hooks so I think that's okay.
It's a bit hard to add tests for this so I decided to leave it be and make huge comments instead.
A lower bundle size variant could be
self._id++