Skip to content

(major) - Tracking PR for v11 #4549

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

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
4769770
Remove replaceNode
JoviDeCroock Nov 10, 2024
bf23fa1
Leverage Object.assign
JoviDeCroock Nov 10, 2024
8a3822d
Remove IE11 unmount hack
JoviDeCroock Nov 10, 2024
ac6cac7
Remove select IE11 fix
JoviDeCroock Nov 10, 2024
f39cd45
Switch to queueMicrotask
JoviDeCroock Nov 10, 2024
45d4a99
Expand todo
JoviDeCroock Nov 10, 2024
98b9ec2
Remove SuspenseList
JoviDeCroock Nov 10, 2024
0620d55
Remove component.base
JoviDeCroock Nov 10, 2024
3f58fe7
Remove more compat IE11 stuff
JoviDeCroock Nov 10, 2024
256a8f9
test: Drop unused/broken test (#4653)
rschristian Feb 11, 2025
efb4feb
Review feedback v11 (#4655)
JoviDeCroock Feb 12, 2025
82fc6b9
Forward ref by default (#4658)
JoviDeCroock Feb 12, 2025
e18f2c5
Use Object.is instead of the adhoc func
JoviDeCroock Feb 12, 2025
4c10ac3
Move `defaultProps` into `preact/compat` (#4657)
JoviDeCroock Feb 13, 2025
c76cfff
Look at impact of removing deprecated lifecycles (#4656)
JoviDeCroock Feb 13, 2025
3c285e1
Remove unused imports
JoviDeCroock Feb 13, 2025
8ca9bd0
fix: Mangle `_listeners` as `__l` instead of `l` (#4463)
rschristian Feb 13, 2025
c223675
Comment denoted hydration (#4636)
JoviDeCroock Feb 13, 2025
a404282
Move back to function
JoviDeCroock Feb 13, 2025
9004289
Save bytes
JoviDeCroock Feb 13, 2025
7ed73e6
refactor: Switch to Object.is for hook args (#4663)
rschristian Feb 14, 2025
938c4e6
Golf hydration 2.0
JoviDeCroock Feb 14, 2025
2355249
Remove constant
JoviDeCroock Feb 14, 2025
23571f1
Revert "Remove constant"
JoviDeCroock Feb 14, 2025
ac4316c
refactor: Breaking changes to outputs & pkg.json (#4652)
rschristian Feb 14, 2025
e9b345e
Remove automatic px suffix (#4665)
JoviDeCroock Feb 14, 2025
63e5525
Remove contains with a simple parentNode check (#4666)
JoviDeCroock Feb 14, 2025
eb21247
Prune portals (#4667)
JoviDeCroock Feb 14, 2025
d5e5d10
Remove SuspenseList mechanism (#4668)
JoviDeCroock Feb 14, 2025
b86bba6
Remove static dom bail (#4670)
JoviDeCroock Feb 14, 2025
fb65296
Add mangle entry for _excess
JoviDeCroock Feb 14, 2025
d063842
Prove bailout still happens
JoviDeCroock Feb 16, 2025
5d2da86
types: Require initial value in `useRef` (#4683)
rschristian Feb 18, 2025
a786942
Cleanup IE11 mentions
JoviDeCroock Feb 26, 2025
dcb611f
Change kb mentions
JoviDeCroock Mar 1, 2025
3e4db38
Remove unused constat
JoviDeCroock Mar 1, 2025
094c33b
refactor: Skip dom check for inferring lower-cased event names (#4720)
rschristian Mar 9, 2025
82e53e6
refactor: Restrict aria roles by element type (#4607)
rschristian Mar 23, 2025
6064449
chore: Specify browser targets in Babel config (#4773)
rschristian May 27, 2025
101cc88
refactor (v11): Remove deprecated 'ForwardFn' type from compat (#4777)
rschristian May 28, 2025
64969d9
Implement deferring state updates (#4760)
JoviDeCroock May 29, 2025
c32db94
Fix mistake in sCU this binding
JoviDeCroock May 29, 2025
a3faafd
Add defaultProps tests
JoviDeCroock May 30, 2025
16926e4
chore: Port non-dimensional regex fix to new v11 (#4772)
rschristian May 31, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

</a>
</p>
<p align="center">Fast <b>3kB</b> alternative to React with the same modern API.</p>
<p align="center">Fast <b>4kB</b> alternative to React with the same modern API.</p>

**All the power of Virtual DOM components, without the overhead:**

- Familiar React API & patterns: ES6 Class, hooks, and Functional Components
- Extensive React compatibility via a simple [preact/compat] alias
- Everything you need: JSX, <abbr title="Virtual DOM">VDOM</abbr>, [DevTools], <abbr title="Hot Module Replacement">HMR</abbr>, <abbr title="Server-Side Rendering">SSR</abbr>.
- Highly optimized diff algorithm and seamless hydration from Server Side Rendering
- Supports all modern browsers and IE11
- Supports all modern browsers
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if we want to specify here, it's fine if it's listed on the doc site instead IMO, but Symbol.for in compat moves our minimums up to these browsers specifically:

chrome 40
safari 9
firefox 36
edge 12

- Transparent asynchronous rendering with a pluggable scheduler

### 💁 More information at the [Preact Website ➞](https://preactjs.com)
Expand Down
8 changes: 7 additions & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ module.exports = function (api) {
modules: noModules ? false : 'auto',
exclude: ['@babel/plugin-transform-typeof-symbol'],
targets: {
browsers: ['last 2 versions', 'IE >= 9']
browsers: [
'chrome >= 40',
'safari >= 9',
'firefox >= 36',
'edge >= 12',
'not dead'
]
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"private": true,
"description": "A React compatibility layer for Preact",
"main": "dist/compat.js",
"module": "dist/compat.module.js",
"module": "dist/compat.mjs",
"umd:main": "dist/compat.umd.js",
"source": "src/index.js",
"types": "src/index.d.ts",
Expand All @@ -19,7 +19,7 @@
"exports": {
".": {
"types": "./src/index.d.ts",
"browser": "./dist/compat.module.js",
"module": "./dist/compat.mjs",
"umd": "./dist/compat.umd.js",
"import": "./dist/compat.mjs",
"require": "./dist/compat.js"
Expand Down
20 changes: 3 additions & 17 deletions compat/src/forwardRef.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
import { options } from 'preact';
import { assign } from './util';

let oldDiffHook = options._diff;
options._diff = vnode => {
if (vnode.type && vnode.type._forwarded && vnode.ref) {
vnode.props.ref = vnode.ref;
vnode.ref = null;
}
if (oldDiffHook) oldDiffHook(vnode);
};

export const REACT_FORWARD_SYMBOL =
(typeof Symbol != 'undefined' &&
Symbol.for &&
Symbol.for('react.forward_ref')) ||
0xf47;
export const REACT_FORWARD_SYMBOL = Symbol.for('react.forward_ref');

/**
* Pass ref down to a child. This is mainly used in libraries with HOCs that
* wrap components. Using `forwardRef` there is an easy way to get a reference
* of the wrapped component instead of one of the wrapper itself.
* @param {import('./index').ForwardFn} fn
* @param {import('./index').ForwardRefRenderFunction} fn
* @returns {import('./internal').FunctionComponent}
*/
export function forwardRef(fn) {
Expand All @@ -38,7 +24,7 @@ export function forwardRef(fn) {
// mobx-react throws.
Forwarded.render = Forwarded;

Forwarded.prototype.isReactComponent = Forwarded._forwarded = true;
Forwarded.prototype.isReactComponent = true;
Forwarded.displayName = 'ForwardRef(' + (fn.displayName || fn.name) + ')';
return Forwarded;
}
3 changes: 1 addition & 2 deletions compat/src/hooks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useState, useLayoutEffect, useEffect } from 'preact/hooks';
import { is } from './util';

/**
* This is taken from https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreShimClient.js#L84
Expand Down Expand Up @@ -47,7 +46,7 @@ function didSnapshotChange(inst) {
const prevValue = inst._value;
try {
const nextValue = latestGetSnapshot();
return !is(prevValue, nextValue);
return !Object.is(prevValue, nextValue);
} catch (error) {
return true;
}
Expand Down
Loading
Loading