Skip to content

Conversation

@JoviDeCroock
Copy link
Member

@JoviDeCroock JoviDeCroock commented Feb 12, 2025

This will be handled in options.vnode for function/class components. This hook gets called for every invocation of jsx/createElement and cloneElement.

Not sure yet on how to fix the types for Context

@github-actions
Copy link

github-actions bot commented Feb 12, 2025

📊 Tachometer Benchmark Results

Summary

⏳ Benchmarks are currently running. Results below are out of date.

duration

  • create10k: unsure 🔍 -1% - +1% (-9.30ms - +5.30ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -1% - +1% (-0.13ms - +0.22ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -1% - +3% (-0.59ms - +2.00ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -4% - +3% (-0.68ms - +0.50ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -1% - +1% (-0.88ms - +0.80ms)
    preact-local vs preact-main
  • text-update: unsure 🔍 -4% - +5% (-0.08ms - +0.10ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -2% - +1% (-0.86ms - +0.19ms)
    preact-local vs preact-main
  • update10th1k: unsure 🔍 -4% - +4% (-1.47ms - +1.43ms)
    preact-local vs preact-main

usedJSHeapSize

  • create10k: unsure 🔍 +0% - +0% (+0.02ms - +0.02ms)
    preact-local vs preact-main
  • filter-list: unsure 🔍 -0% - +2% (-0.00ms - +0.03ms)
    preact-local vs preact-main
  • hydrate1k: unsure 🔍 -5% - +3% (-0.51ms - +0.37ms)
    preact-local vs preact-main
  • many-updates: unsure 🔍 -0% - +1% (-0.01ms - +0.02ms)
    preact-local vs preact-main
  • replace1k: unsure 🔍 -1% - +1% (-0.02ms - +0.02ms)
    preact-local vs preact-main
  • text-update: faster ✔ 0% - 1% (0.00ms - 0.01ms)
    preact-local vs preact-main
  • todo: unsure 🔍 -1% - +1% (-0.01ms - +0.01ms)
    preact-local vs preact-main
  • update10th1k: faster ✔ 0% - 1% (0.01ms - 0.03ms)
    preact-local vs preact-main

Results

⏳ Benchmarks are currently running. Results below are out of date.
create10k

duration

VersionAvg timevs preact-localvs preact-main
preact-local939.43ms - 949.40ms-unsure 🔍
-1% - +1%
-9.30ms - +5.30ms
preact-main941.09ms - 951.75msunsure 🔍
-1% - +1%
-5.30ms - +9.30ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local19.21ms - 19.22ms-unsure 🔍
+0% - +0%
+0.02ms - +0.02ms
preact-main19.20ms - 19.20msunsure 🔍
-0% - -0%
-0.02ms - -0.02ms
-
filter-list

duration

VersionAvg timevs preact-localvs preact-main
preact-local16.50ms - 16.82ms-unsure 🔍
-1% - +1%
-0.13ms - +0.22ms
preact-main16.54ms - 16.68msunsure 🔍
-1% - +1%
-0.22ms - +0.13ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.51ms - 1.54ms-unsure 🔍
-0% - +2%
-0.00ms - +0.03ms
preact-main1.50ms - 1.52msunsure 🔍
-2% - +0%
-0.03ms - +0.00ms
-
hydrate1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local76.68ms - 78.55ms-unsure 🔍
-1% - +3%
-0.59ms - +2.00ms
preact-main76.01ms - 77.81msunsure 🔍
-3% - +1%
-2.00ms - +0.59ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local10.38ms - 10.94ms-unsure 🔍
-5% - +3%
-0.51ms - +0.37ms
preact-main10.39ms - 11.07msunsure 🔍
-4% - +5%
-0.37ms - +0.51ms
-
many-updates

duration

VersionAvg timevs preact-localvs preact-main
preact-local17.19ms - 18.18ms-unsure 🔍
-4% - +3%
-0.68ms - +0.50ms
preact-main17.44ms - 18.11msunsure 🔍
-3% - +4%
-0.50ms - +0.68ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local3.75ms - 3.78ms-unsure 🔍
-0% - +1%
-0.01ms - +0.02ms
preact-main3.75ms - 3.77msunsure 🔍
-1% - +0%
-0.02ms - +0.01ms
-
replace1k
  • Browser: chrome-headless
  • Sample size: 100
  • Built by: CI #4331
  • Commit: 6c34c2b

duration

VersionAvg timevs preact-localvs preact-main
preact-local65.01ms - 65.77ms-unsure 🔍
-1% - +1%
-0.88ms - +0.80ms
preact-main64.68ms - 66.19msunsure 🔍
-1% - +1%
-0.80ms - +0.88ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local2.96ms - 3.00ms-unsure 🔍
-1% - +1%
-0.02ms - +0.02ms
preact-main2.97ms - 2.99msunsure 🔍
-1% - +1%
-0.02ms - +0.02ms
-

run-warmup-0

VersionAvg timevs preact-localvs preact-main
preact-local29.58ms - 30.14ms-unsure 🔍
-2% - +1%
-0.53ms - +0.29ms
preact-main29.69ms - 30.28msunsure 🔍
-1% - +2%
-0.29ms - +0.53ms
-

run-warmup-1

VersionAvg timevs preact-localvs preact-main
preact-local33.56ms - 34.57ms-unsure 🔍
-1% - +2%
-0.46ms - +0.83ms
preact-main33.48ms - 34.27msunsure 🔍
-2% - +1%
-0.83ms - +0.46ms
-

run-warmup-2

VersionAvg timevs preact-localvs preact-main
preact-local25.75ms - 26.13ms-unsure 🔍
-2% - +1%
-0.53ms - +0.17ms
preact-main25.83ms - 26.42msunsure 🔍
-1% - +2%
-0.17ms - +0.53ms
-

run-warmup-3

VersionAvg timevs preact-localvs preact-main
preact-local26.48ms - 27.61ms-unsure 🔍
-0% - +6%
+0.01ms - +1.63ms
preact-main25.64ms - 26.81msfaster ✔
0% - 6%
0.01ms - 1.63ms
-

run-warmup-4

VersionAvg timevs preact-localvs preact-main
preact-local24.85ms - 26.23ms-unsure 🔍
-4% - +3%
-1.04ms - +0.80ms
preact-main25.05ms - 26.27msunsure 🔍
-3% - +4%
-0.80ms - +1.04ms
-

run-final

VersionAvg timevs preact-localvs preact-main
preact-local20.60ms - 21.00ms-unsure 🔍
-2% - +2%
-0.33ms - +0.42ms
preact-main20.43ms - 21.07msunsure 🔍
-2% - +2%
-0.42ms - +0.33ms
-
text-update
  • Browser: chrome-headless
  • Sample size: 140
  • Built by: CI #4331
  • Commit: 6c34c2b

duration

VersionAvg timevs preact-localvs preact-main
preact-local2.03ms - 2.18ms-unsure 🔍
-4% - +5%
-0.08ms - +0.10ms
preact-main2.04ms - 2.14msunsure 🔍
-5% - +4%
-0.10ms - +0.08ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.10ms - 1.11ms-faster ✔
0% - 1%
0.00ms - 0.01ms
preact-main1.11ms - 1.11msslower ❌
0% - 1%
0.00ms - 0.01ms
-
todo

duration

VersionAvg timevs preact-localvs preact-main
preact-local33.51ms - 34.23ms-unsure 🔍
-2% - +1%
-0.86ms - +0.19ms
preact-main33.82ms - 34.58msunsure 🔍
-1% - +3%
-0.19ms - +0.86ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local1.21ms - 1.23ms-unsure 🔍
-1% - +1%
-0.01ms - +0.01ms
preact-main1.21ms - 1.22msunsure 🔍
-1% - +1%
-0.01ms - +0.01ms
-
update10th1k

duration

VersionAvg timevs preact-localvs preact-main
preact-local33.49ms - 35.78ms-unsure 🔍
-4% - +4%
-1.47ms - +1.43ms
preact-main33.77ms - 35.54msunsure 🔍
-4% - +4%
-1.43ms - +1.47ms
-

usedJSHeapSize

VersionAvg timevs preact-localvs preact-main
preact-local2.90ms - 2.91ms-faster ✔
0% - 1%
0.01ms - 0.03ms
preact-main2.91ms - 2.94msslower ❌
0% - 1%
0.01ms - 0.03ms
-

tachometer-reporter-action v2 for CI

@JoviDeCroock JoviDeCroock mentioned this pull request Feb 12, 2025
1 task
@github-actions
Copy link

github-actions bot commented Feb 12, 2025

Size Change: 0 B

Total Size: 60.6 kB

ℹ️ View Unchanged
Filename Size
compat/dist/compat.js 3.75 kB
compat/dist/compat.module.js 3.67 kB
compat/dist/compat.umd.js 3.81 kB
debug/dist/debug.js 3.87 kB
debug/dist/debug.module.js 3.87 kB
debug/dist/debug.umd.js 3.95 kB
devtools/dist/devtools.js 260 B
devtools/dist/devtools.module.js 274 B
devtools/dist/devtools.umd.js 346 B
dist/preact.js 4.56 kB
dist/preact.min.js 4.6 kB
dist/preact.min.module.js 4.59 kB
dist/preact.min.umd.js 4.63 kB
dist/preact.module.js 4.59 kB
dist/preact.umd.js 4.65 kB
hooks/dist/hooks.js 1.54 kB
hooks/dist/hooks.module.js 1.57 kB
hooks/dist/hooks.umd.js 1.61 kB
jsx-runtime/dist/jsxRuntime.js 957 B
jsx-runtime/dist/jsxRuntime.module.js 926 B
jsx-runtime/dist/jsxRuntime.umd.js 1.03 kB
test-utils/dist/testUtils.js 473 B
test-utils/dist/testUtils.module.js 477 B
test-utils/dist/testUtils.umd.js 555 B

compressed-size-action

@JoviDeCroock JoviDeCroock force-pushed the remove-defaultprops branch 3 times, most recently from 434b77f to 8a2371a Compare February 13, 2025 10:31
This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.
@JoviDeCroock JoviDeCroock force-pushed the remove-defaultprops branch 3 times, most recently from 9c77efe to 6ee3c04 Compare February 13, 2025 11:16
@rschristian
Copy link
Member

Still playing around with it, but I think we want something starting like this:

declare module 'preact' {
	export interface FunctionComponent<P = {}> {
		(props: preact.RenderableProps<P>, context?: any): preact.ComponentChildren;
		displayName?: string;
		defaultProps?: Partial<P> | undefined;
	}

	export interface ComponentClass<P = {}, S = {}> {
		new (props: P, context?: any): preact.Component<P, S>;
		displayName?: string;
		defaultProps?: Partial<P>;
		contextType?: preact.Context<any>;
		getDerivedStateFromProps?(
			props: Readonly<P>,
			state: Readonly<S>
		): Partial<S> | null;
		getDerivedStateFromError?(error: any): Partial<S> | null;
	}
}

The problem is the abstract class Component, which, as far as I can tell, cannot be merged. I don't yet know how to work around that

@JoviDeCroock JoviDeCroock merged commit c4ed4f4 into v11-2 Feb 13, 2025
3 checks passed
@JoviDeCroock JoviDeCroock deleted the remove-defaultprops branch February 13, 2025 12:08
JoviDeCroock added a commit that referenced this pull request Feb 13, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
JoviDeCroock added a commit that referenced this pull request Feb 18, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
JoviDeCroock added a commit that referenced this pull request Feb 19, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
JoviDeCroock added a commit that referenced this pull request Feb 26, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
JoviDeCroock added a commit that referenced this pull request Feb 27, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
JoviDeCroock added a commit that referenced this pull request Mar 1, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
JoviDeCroock added a commit that referenced this pull request Mar 9, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
JoviDeCroock added a commit that referenced this pull request Mar 14, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
JoviDeCroock added a commit that referenced this pull request Mar 22, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
JoviDeCroock added a commit that referenced this pull request Apr 8, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
JoviDeCroock added a commit that referenced this pull request May 3, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
JoviDeCroock added a commit that referenced this pull request May 8, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
JoviDeCroock added a commit that referenced this pull request May 23, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
JoviDeCroock added a commit that referenced this pull request May 30, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
JoviDeCroock added a commit that referenced this pull request Jun 6, 2025
* Move `defaultProps` into `preact/compat`

This will be handled in `options.vnode` for function/class components.
This hook gets called for every invocation of `jsx`/`createElement` and
`cloneElement`.

* Try it

* refactor: This is horrific but seems to work? (#4662)

---------

Co-authored-by: Ryan Christian <[email protected]>
@JoviDeCroock JoviDeCroock mentioned this pull request Aug 19, 2025
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.

3 participants