Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: Expose hooks through compat's ReactCurrentDispatcher #4342

Merged
merged 2 commits into from
Apr 19, 2024

Conversation

rschristian
Copy link
Member

@rschristian rschristian commented Apr 19, 2024

Fixes #3841

Recoil checks if useSyncExternalStore exists on ReactCurrentDispatcher (with comments as towards why they do this), and as we do not provide this, it'll print out a warning and use an internal implementation instead. Easy enough for us to support though.

The only other property React adds here (at the moment) is a unstable_isNewReconciler which feels like something we can ignore.

Copy link

github-actions bot commented Apr 19, 2024

📊 Tachometer Benchmark Results

Summary

duration

  • create10k: unsure 🔍 -1% - +1% (-5.68ms - +8.34ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -3% - +0% (-0.45ms - +0.07ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -2% - +0% (-1.17ms - +0.30ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -2% - +4% (-0.37ms - +0.64ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -2% - +0% (-1.46ms - +0.05ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -2% - +5% (-0.04ms - +0.08ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -1% - +3% (-0.21ms - +0.81ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -4% - +3% (-1.48ms - +1.09ms)
    preact-local vs preact-main

usedJSHeapSize

  • create10k: unsure 🔍 +0% - +0% (+0.00ms - +0.00ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +0% (-0.00ms - +0.01ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -0% - +0% (-0.00ms - +0.01ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -1% - +0% (-0.01ms - +0.00ms)
    preact-local vs preact-main
  • todo: unsure 🔍 +0% - +0% (+0.00ms - +0.00ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-main

Results

create10k

duration

VersionAvg timevs preact-localvs preact-main
preact-local892.63ms - 901.32ms-unsure 🔍
-1% - +1%
-5.68ms - +8.34ms
preact-main890.14ms - 901.15msunsure 🔍
-1% - +1%
-8.34ms - +5.68ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local26.79ms - 26.79ms-unsure 🔍
+0% - +0%
+0.00ms - +0.00ms
preact-main26.79ms - 26.79msunsure 🔍
-0% - -0%
-0.00ms - -0.00ms
-
filter-list

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.45ms - 16.63ms-unsure 🔍
-3% - +0%
-0.45ms - +0.07ms
preact-main16.50ms - 16.98msunsure 🔍
-0% - +3%
-0.07ms - +0.45ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.64ms - 1.64ms-unsure 🔍
-0% - +0%
-0.00ms - +0.01ms
preact-main1.63ms - 1.64msunsure 🔍
-0% - +0%
-0.01ms - +0.00ms
-
hydrate1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local74.84ms - 75.85ms-unsure 🔍
-2% - +0%
-1.17ms - +0.30ms
preact-main75.25ms - 76.31msunsure 🔍
-0% - +2%
-0.30ms - +1.17ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local6.47ms - 6.47ms-unsure 🔍
-0% - +0%
-0.00ms - +0.01ms
preact-main6.47ms - 6.47msunsure 🔍
-0% - +0%
-0.01ms - +0.00ms
-
many-updates

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.56ms - 17.33ms-unsure 🔍
-2% - +4%
-0.37ms - +0.64ms
preact-main16.48ms - 17.15msunsure 🔍
-4% - +2%
-0.64ms - +0.37ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local4.74ms - 4.74ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
preact-main4.74ms - 4.74msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-
replace1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local66.11ms - 67.16ms-unsure 🔍
-2% - +0%
-1.46ms - +0.05ms
preact-main66.80ms - 67.88msunsure 🔍
-0% - +2%
-0.05ms - +1.46ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.67ms - 3.68ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
preact-main3.67ms - 3.68msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local27.56ms - 28.30ms-unsure 🔍
-1% - +2%
-0.25ms - +0.67ms
preact-main27.45ms - 27.99msunsure 🔍
-2% - +1%
-0.67ms - +0.25ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local33.96ms - 35.62ms-unsure 🔍
-2% - +5%
-0.52ms - +1.74ms
preact-main33.41ms - 34.95msunsure 🔍
-5% - +1%
-1.74ms - +0.52ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local24.31ms - 24.91ms-unsure 🔍
-1% - +2%
-0.25ms - +0.43ms
preact-main24.37ms - 24.69msunsure 🔍
-2% - +1%
-0.43ms - +0.25ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local23.09ms - 23.97ms-unsure 🔍
-1% - +4%
-0.23ms - +0.88ms
preact-main22.87ms - 23.54msunsure 🔍
-4% - +1%
-0.88ms - +0.23ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local29.40ms - 30.92ms-unsure 🔍
-1% - +7%
-0.15ms - +2.11ms
preact-main28.34ms - 30.02msunsure 🔍
-7% - +0%
-2.11ms - +0.15ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local21.95ms - 22.69ms-unsure 🔍
-3% - +2%
-0.60ms - +0.41ms
preact-main22.07ms - 22.76msunsure 🔍
-2% - +3%
-0.41ms - +0.60ms
-
text-update

duration

VersionAvg timevs preact-localvs preact-main
preact-local1.71ms - 1.81ms-unsure 🔍
-2% - +5%
-0.04ms - +0.08ms
preact-main1.70ms - 1.78msunsure 🔍
-5% - +2%
-0.08ms - +0.04ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.01ms - 1.01ms-unsure 🔍
-1% - +0%
-0.01ms - +0.00ms
preact-main1.01ms - 1.02msunsure 🔍
-0% - +1%
-0.00ms - +0.01ms
-
todo

duration

VersionAvg timevs preact-localvs preact-main
preact-local27.79ms - 28.78ms-unsure 🔍
-1% - +3%
-0.21ms - +0.81ms
preact-main27.86ms - 28.11msunsure 🔍
-3% - +1%
-0.81ms - +0.21ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.13ms - 1.13ms-unsure 🔍
+0% - +0%
+0.00ms - +0.00ms
preact-main1.13ms - 1.13msunsure 🔍
-0% - -0%
-0.00ms - -0.00ms
-
update10th1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local33.09ms - 34.85ms-unsure 🔍
-4% - +3%
-1.48ms - +1.09ms
preact-main33.23ms - 35.10msunsure 🔍
-3% - +4%
-1.09ms - +1.48ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.59ms - 3.60ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
preact-main3.59ms - 3.61msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-

tachometer-reporter-action v2 for Benchmarks

Copy link

Size Change: +103 B (0%)

Total Size: 60.7 kB

Filename Size Change
compat/dist/compat.js 4.09 kB +35 B (0%)
compat/dist/compat.module.js 4.01 kB +36 B (0%)
compat/dist/compat.umd.js 4.14 kB +32 B (0%)
ℹ️ View Unchanged
Filename Size Change
debug/dist/debug.js 3.52 kB 0 B
debug/dist/debug.module.js 3.52 kB 0 B
debug/dist/debug.umd.js 3.6 kB 0 B
devtools/dist/devtools.js 230 B 0 B
devtools/dist/devtools.module.js 239 B 0 B
devtools/dist/devtools.umd.js 314 B 0 B
dist/preact.js 4.61 kB 0 B
dist/preact.min.js 4.64 kB 0 B
dist/preact.min.module.js 4.64 kB 0 B
dist/preact.min.umd.js 4.67 kB 0 B
dist/preact.module.js 4.62 kB 0 B
dist/preact.umd.js 4.68 kB 0 B
hooks/dist/hooks.js 1.55 kB 0 B
hooks/dist/hooks.module.js 1.59 kB 0 B
hooks/dist/hooks.umd.js 1.63 kB 0 B
jsx-runtime/dist/jsxRuntime.js 976 B 0 B
jsx-runtime/dist/jsxRuntime.module.js 949 B 0 B
jsx-runtime/dist/jsxRuntime.umd.js 1.06 kB 0 B
test-utils/dist/testUtils.js 453 B 0 B
test-utils/dist/testUtils.module.js 454 B 0 B
test-utils/dist/testUtils.umd.js 536 B 0 B

compressed-size-action

@coveralls
Copy link

coveralls commented Apr 19, 2024

Coverage Status

coverage: 99.605%. remained the same
when pulling 033f296 on fix/compat-hooks-currentDispatcher
into 962594b on main.

@JoviDeCroock JoviDeCroock merged commit 3123e7f into main Apr 19, 2024
13 checks passed
@JoviDeCroock JoviDeCroock deleted the fix/compat-hooks-currentDispatcher branch April 19, 2024 05:21
@JoviDeCroock JoviDeCroock mentioned this pull request Apr 29, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A React renderer without React 18+ API support is being used with React 18+.
3 participants