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

Merge master into v11 #3943

Open
wants to merge 431 commits into
base: v11
Choose a base branch
from
Open

Merge master into v11 #3943

wants to merge 431 commits into from

Conversation

andrewiggins
Copy link
Member

@andrewiggins andrewiggins commented Mar 21, 2023

A lot of good work has gone into v10 and I lost track of what changes have been cherry-picked into v11 and which ones still needed to be brought over so I did a full merge from master to v11. I think at one point we decided not to do full merges, but I figured since there has been a surge in work on v10, doing a full merge would ensure nothing was missed. I'll try to start doing these more regularly so that they are more approachable and things stay in sync.

Since this is a massive change, I'll try to summarize the significant changes and add comments in the PR for the interesting parts.

Changes:

  • Update benchmark infra and CI builds to reduce duplication
  • Upgrade CI actions
  • Readme updates
  • Dependency upgrades
  • Use volta to manage node versions
  • Add preact hooks benchmark package
  • Fix up compat entrypoints (e.g. scheduler.js and scheduler.mjs)
  • Add support for errorInfo parameter to componentDidCatch
  • Reorder some test files and mangle.json to match what is in master
  • Add the release scripts from master to v11. However they'll need to be updated to accommodate changesets in v11
  • Add useId implementation
  • Bring over Jovi's compat perf improvements
  • Fix textarea hydration in compat
  • Add isStaticChildren to jsx-runtime packages
  • Update package.json files and exports arrays
  • Batch state updates on microtick
  • Force rerender components with context update
  • Coerce null and undefined to empty string when calling style.setProperty
  • Support signals in JSX types
  • Add undefined to JSX types to support new TS option
  • Improve ARIA typings in JSX types

JoviDeCroock and others added 30 commits May 29, 2022 12:06
…3562)

* ensure both onchange and oninput callbacks are attached to the event listener

* remove custom hook and combiner callbacks in one

* update implementation and unit test

* remove only on tests and improve error handling

* cover scenario changing order

* allow uncaught error in unit test

* use event hook to trigger oncompatchange handler

* use oninputCapture rather than oninput when both callbacks are defined

Co-authored-by: Jovi De Croock <[email protected]>
* add export maps to the subpackages

* format

* run pretteir on package json files
…-input

restrict "oninputCapture" conversion to just "oninput" vs "oninput*"
@github-actions
Copy link

github-actions bot commented Mar 21, 2023

📊 Tachometer Benchmark Results

Summary

duration

  • 02_replace1k: unsure 🔍 -2% - +2% (-4.01ms - +2.81ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -2% - +0% (-0.78ms - +0.04ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 -1% - +1% (-12.37ms - +11.44ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -1% - +2% (-4.06ms - +5.59ms)
    preact-local vs preact-master
  • hydrate1k: unsure 🔍 -5% - +11% (-4.61ms - +11.42ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -1% - +2% (-2.89ms - +4.56ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 -1% - +1% (-0.48ms - +0.32ms)
    preact-local vs preact-master
  • todo: faster ✔ 4% - 5% (1.70ms - 2.10ms)
    preact-local vs preact-master

usedJSHeapSize

  • 02_replace1k: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-master
  • 03_update10th1k_x16: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master
  • 07_create10k: unsure 🔍 -0% - +0% (-0.05ms - +0.02ms)
    preact-local vs preact-master
  • filter_list: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-master
  • hydrate1k: unsure 🔍 -5% - +7% (-0.62ms - +0.91ms)
    preact-local vs preact-master
  • many_updates: unsure 🔍 -0% - +0% (-0.01ms - +0.01ms)
    preact-local vs preact-master
  • text_update: unsure 🔍 +0% - +0% (+0.00ms - +0.01ms)
    preact-local vs preact-master
  • todo: unsure 🔍 -0% - +0% (-0.00ms - +0.00ms)
    preact-local vs preact-master

Results

02_replace1k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master164.39ms - 169.50ms-unsure 🔍
-2% - +2%
-2.81ms - +4.01ms
faster ✔
0% - 5%
0.48ms - 7.94ms
preact-local164.09ms - 168.61msunsure 🔍
-2% - +2%
-4.01ms - +2.81ms
-faster ✔
1% - 5%
1.27ms - 8.34ms
preact-hooks168.44ms - 173.88msslower ❌
0% - 5%
0.48ms - 7.94ms
slower ❌
1% - 5%
1.27ms - 8.34ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master3.82ms - 3.83ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
faster ✔
1% - 1%
0.02ms - 0.03ms
preact-local3.82ms - 3.83msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-faster ✔
0% - 1%
0.02ms - 0.03ms
preact-hooks3.84ms - 3.85msslower ❌
1% - 1%
0.02ms - 0.03ms
slower ❌
0% - 1%
0.02ms - 0.03ms
-

run-warmup-0

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master59.31ms - 61.75ms-unsure 🔍
-3% - +3%
-1.60ms - +1.92ms
faster ✔
1% - 6%
0.36ms - 3.88ms
preact-local59.10ms - 61.64msunsure 🔍
-3% - +3%
-1.92ms - +1.60ms
-faster ✔
1% - 6%
0.49ms - 4.08ms
preact-hooks61.38ms - 63.92msslower ❌
1% - 6%
0.36ms - 3.88ms
slower ❌
1% - 7%
0.49ms - 4.08ms
-

run-warmup-1

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master63.10ms - 66.14ms-unsure 🔍
-0% - +6%
-0.19ms - +3.68ms
unsure 🔍
-3% - +3%
-2.09ms - +2.10ms
preact-local61.68ms - 64.07msunsure 🔍
-6% - +0%
-3.68ms - +0.19ms
-unsure 🔍
-6% - +0%
-3.62ms - +0.13ms
preact-hooks63.18ms - 66.06msunsure 🔍
-3% - +3%
-2.10ms - +2.09ms
unsure 🔍
-0% - +6%
-0.13ms - +3.62ms
-

run-warmup-2

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master63.78ms - 66.43ms-unsure 🔍
-4% - +3%
-2.81ms - +1.76ms
unsure 🔍
-3% - +4%
-1.87ms - +2.42ms
preact-local63.78ms - 67.49msunsure 🔍
-3% - +4%
-1.76ms - +2.81ms
-unsure 🔍
-3% - +5%
-1.71ms - +3.31ms
preact-hooks63.14ms - 66.52msunsure 🔍
-4% - +3%
-2.42ms - +1.87ms
unsure 🔍
-5% - +3%
-3.31ms - +1.71ms
-

run-final

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master63.00ms - 65.22ms-unsure 🔍
-2% - +2%
-1.60ms - +1.37ms
faster ✔
2% - 7%
1.08ms - 4.54ms
preact-local63.23ms - 65.21msunsure 🔍
-2% - +3%
-1.37ms - +1.60ms
-faster ✔
2% - 6%
1.04ms - 4.35ms
preact-hooks65.59ms - 68.25msslower ❌
2% - 7%
1.08ms - 4.54ms
slower ❌
2% - 7%
1.04ms - 4.35ms
-
03_update10th1k_x16

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master35.63ms - 36.27ms-unsure 🔍
-0% - +2%
-0.04ms - +0.78ms
unsure 🔍
-1% - +2%
-0.36ms - +0.64ms
preact-local35.32ms - 35.83msunsure 🔍
-2% - +0%
-0.78ms - +0.04ms
-unsure 🔍
-2% - +1%
-0.69ms - +0.23ms
preact-hooks35.42ms - 36.20msunsure 🔍
-2% - +1%
-0.64ms - +0.36ms
unsure 🔍
-1% - +2%
-0.23ms - +0.69ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master3.79ms - 3.80ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
1% - 1%
0.03ms - 0.03ms
preact-local3.79ms - 3.80msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
1% - 1%
0.03ms - 0.03ms
preact-hooks3.82ms - 3.82msslower ❌
1% - 1%
0.03ms - 0.03ms
slower ❌
1% - 1%
0.03ms - 0.03ms
-
07_create10k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1356.88ms - 1377.22ms-unsure 🔍
-1% - +1%
-11.44ms - +12.37ms
unsure 🔍
-1% - +1%
-18.58ms - +7.89ms
preact-local1360.40ms - 1372.78msunsure 🔍
-1% - +1%
-12.37ms - +11.44ms
-unsure 🔍
-1% - +0%
-16.30ms - +4.68ms
preact-hooks1363.92ms - 1380.87msunsure 🔍
-1% - +1%
-7.89ms - +18.58ms
unsure 🔍
-0% - +1%
-4.68ms - +16.30ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master26.29ms - 26.33ms-unsure 🔍
-0% - +0%
-0.02ms - +0.05ms
unsure 🔍
-0% - +0%
-0.05ms - +0.01ms
preact-local26.27ms - 26.32msunsure 🔍
-0% - +0%
-0.05ms - +0.02ms
-unsure 🔍
-0% - -0%
-0.07ms - -0.01ms
preact-hooks26.31ms - 26.35msunsure 🔍
-0% - +0%
-0.01ms - +0.05ms
unsure 🔍
+0% - +0%
+0.01ms - +0.07ms
-
filter_list

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master271.57ms - 277.99ms-unsure 🔍
-2% - +1%
-5.59ms - +4.06ms
faster ✔
1% - 5%
2.70ms - 12.90ms
preact-local271.94ms - 279.14msunsure 🔍
-1% - +2%
-4.06ms - +5.59ms
-faster ✔
1% - 4%
1.68ms - 12.38ms
preact-hooks278.62ms - 286.54msslower ❌
1% - 5%
2.70ms - 12.90ms
slower ❌
1% - 5%
1.68ms - 12.38ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.82ms - 1.83ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
faster ✔
2% - 3%
0.04ms - 0.05ms
preact-local1.82ms - 1.83msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-faster ✔
2% - 3%
0.04ms - 0.05ms
preact-hooks1.87ms - 1.87msslower ❌
2% - 3%
0.04ms - 0.05ms
slower ❌
2% - 3%
0.04ms - 0.05ms
-
hydrate1k

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master95.64ms - 106.60ms-unsure 🔍
-11% - +4%
-11.42ms - +4.61ms
unsure 🔍
-7% - +8%
-6.91ms - +8.46ms
preact-local98.68ms - 110.37msunsure 🔍
-5% - +11%
-4.61ms - +11.42ms
-unsure 🔍
-4% - +12%
-3.78ms - +12.13ms
preact-hooks94.96ms - 105.74msunsure 🔍
-8% - +7%
-8.46ms - +6.91ms
unsure 🔍
-11% - +3%
-12.13ms - +3.78ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master13.02ms - 14.00ms-unsure 🔍
-7% - +4%
-0.91ms - +0.62ms
unsure 🔍
-3% - +7%
-0.42ms - +0.96ms
preact-local13.07ms - 14.24msunsure 🔍
-5% - +7%
-0.62ms - +0.91ms
-unsure 🔍
-3% - +9%
-0.35ms - +1.18ms
preact-hooks12.75ms - 13.73msunsure 🔍
-7% - +3%
-0.96ms - +0.42ms
unsure 🔍
-9% - +2%
-1.18ms - +0.35ms
-
many_updates

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master215.15ms - 220.46ms-unsure 🔍
-2% - +1%
-4.56ms - +2.89ms
faster ✔
3% - 6%
6.70ms - 14.73ms
preact-local216.03ms - 221.25msunsure 🔍
-1% - +2%
-2.89ms - +4.56ms
-faster ✔
3% - 6%
5.90ms - 13.87ms
preact-hooks225.52ms - 231.54msslower ❌
3% - 7%
6.70ms - 14.73ms
slower ❌
3% - 6%
5.90ms - 13.87ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master5.18ms - 5.19ms-unsure 🔍
-0% - +0%
-0.01ms - +0.01ms
faster ✔
0% - 1%
0.02ms - 0.03ms
preact-local5.18ms - 5.19msunsure 🔍
-0% - +0%
-0.01ms - +0.01ms
-faster ✔
0% - 1%
0.03ms - 0.04ms
preact-hooks5.21ms - 5.21msslower ❌
0% - 1%
0.02ms - 0.03ms
slower ❌
0% - 1%
0.03ms - 0.04ms
-
text_update

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master44.04ms - 44.60ms-unsure 🔍
-1% - +1%
-0.32ms - +0.48ms
faster ✔
5% - 7%
2.39ms - 3.14ms
preact-local43.95ms - 44.52msunsure 🔍
-1% - +1%
-0.48ms - +0.32ms
-faster ✔
5% - 7%
2.46ms - 3.22ms
preact-hooks46.83ms - 47.33msslower ❌
5% - 7%
2.39ms - 3.14ms
slower ❌
6% - 7%
2.46ms - 3.22ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.06ms - 1.06ms-unsure 🔍
-0% - -0%
-0.01ms - -0.00ms
faster ✔
3% - 3%
0.03ms - 0.03ms
preact-local1.06ms - 1.07msunsure 🔍
+0% - +0%
+0.00ms - +0.01ms
-faster ✔
2% - 3%
0.03ms - 0.03ms
preact-hooks1.09ms - 1.10msslower ❌
3% - 3%
0.03ms - 0.03ms
slower ❌
2% - 3%
0.03ms - 0.03ms
-
todo

duration

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master42.97ms - 43.24ms-slower ❌
4% - 5%
1.70ms - 2.10ms
faster ✔
0% - 1%
0.02ms - 0.47ms
preact-local41.05ms - 41.35msfaster ✔
4% - 5%
1.70ms - 2.10ms
-faster ✔
4% - 5%
1.91ms - 2.38ms
preact-hooks43.17ms - 43.53msslower ❌
0% - 1%
0.02ms - 0.47ms
slower ❌
5% - 6%
1.91ms - 2.38ms
-

usedJSHeapSize

VersionAvg timevs preact-mastervs preact-localvs preact-hooks
preact-master1.09ms - 1.09ms-unsure 🔍
-0% - +0%
-0.00ms - +0.00ms
faster ✔
3% - 3%
0.03ms - 0.03ms
preact-local1.09ms - 1.09msunsure 🔍
-0% - +0%
-0.00ms - +0.00ms
-faster ✔
3% - 3%
0.03ms - 0.03ms
preact-hooks1.12ms - 1.12msslower ❌
3% - 3%
0.03ms - 0.03ms
slower ❌
3% - 3%
0.03ms - 0.03ms
-

tachometer-reporter-action v2 for Benchmarks

@coveralls
Copy link

coveralls commented Mar 21, 2023

Coverage Status

Coverage: 99.582% (+0.2%) from 99.43% when pulling 3ff2944 on v11-merge-master into da7c661 on v11.

@github-actions
Copy link

github-actions bot commented Mar 21, 2023

Size Change: +778 B (2%)

Total Size: 33.4 kB

Filename Size Change
compat/dist/compat.js 3.52 kB -25 B (0%)
compat/dist/compat.umd.js 3.59 kB -24 B (0%)
debug/dist/debug.js 3.27 kB +188 B (5%) 🔍
debug/dist/debug.umd.js 3.34 kB +179 B (5%) 🔍
dist/preact.js 4.7 kB +85 B (1%)
dist/preact.min.js 4.75 kB +94 B (1%)
dist/preact.umd.js 4.81 kB +92 B (1%)
hooks/dist/hooks.js 1.57 kB +96 B (6%) 🔍
hooks/dist/hooks.umd.js 1.64 kB +90 B (5%) 🔍
jsx-runtime/dist/jsxRuntime.js 298 B +2 B (0%)
jsx-runtime/dist/jsxRuntime.umd.js 380 B +1 B
ℹ️ View Unchanged
Filename Size Change
devtools/dist/devtools.js 232 B 0 B
devtools/dist/devtools.umd.js 317 B 0 B
test-utils/dist/testUtils.js 437 B 0 B
test-utils/dist/testUtils.umd.js 522 B 0 B

compressed-size-action

@@ -170,6 +170,29 @@ We closely watch our issues and have a pretty active [Slack workspace](https://c
This guide is intended for core team members that have the necessary
rights to publish new releases on npm.

**TODO: Update instructions for v11 to include changesets**
Copy link
Member Author

Choose a reason for hiding this comment

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

At some future point we should update these instructions. I created a task in our project to track that.

* Strict Mode is not implemented in Preact, so we provide a stand-in for it
* that just renders its children without imposing any restrictions.
*/
const StrictMode = Fragment;
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved below flushSync to match master

Comment on lines -146 to -148
function is(x, y) {
return (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y);
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved to utils file to match master

@@ -394,6 +398,32 @@ Component.prototype.setState = function(update, callback) {
return setState.call(this, update, callback);
};

/** @this {import('../../src/internal').Component} */
Component.prototype.forceUpdate = function(callback) {
Copy link
Member Author

Choose a reason for hiding this comment

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

This check still exists in master so i've brought it back to keep them in-sync. For this change, I'd say we should do it in both or neither. I don't think this particular change (i.e. removing this earning) needs to be delayed for a major release.

Comment on lines +131 to +136
// TODO: Required for RTS which currently doesn't set the `.data` property.
// Should we move this to RTS?
if (!currentInternal.data) {
currentInternal.data = {};
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Added a task to the project board for this

@@ -303,6 +299,13 @@ function patchComponent(internal, newVNode) {
c.componentDidUpdate(oldProps, oldState, snapshot);
});
}

if (internal.data._stateCallbacks) {
Copy link
Member Author

Choose a reason for hiding this comment

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

@JoviDeCroock Is this move safe? All tests pass but it could use your eyes as well to double check. I moved it so state callbacks and componentDidUpdate are invoked in the same order as React and v10

@andrewiggins
Copy link
Member Author

andrewiggins commented Mar 22, 2023

Fix the benchmarks by manually setting debounceRendering to queueMicrotask so every version is batching using the same behavior and the numbers we are comparing are the same measurements in each version.

The regression in 03_update10th1k benchmark is cuz this PR switches v11 from setTimeout batching back to microtask batching which invalidates this benchmark. Before, the benchmark duration measure did not include the big layout/paint task. With microtask batching, it now does.

From reading the code I believe this bench is suppose to capture the layout/paint task so this PR fixes the benchmark.

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.