preact icon indicating copy to clipboard operation
preact copied to clipboard

feat: support use hook

Open gaoachao opened this issue 3 weeks ago • 3 comments

close #4756

gaoachao avatar Dec 02 '25 15:12 gaoachao

📊 Tachometer Benchmark Results

Summary

A summary of the benchmark results will show here once they finish.

Results

The full results of your benchmarks will show here once they finish.

tachometer-reporter-action v2 for CI

github-actions[bot] avatar Dec 02 '25 15:12 github-actions[bot]

As I tried to make clear in my suggestions/comments, the philosophy of preact is to optimize for performance and size. We should also not leak implementation details into core for the sake of it.

EDIT: thinking more about the PROMISE_CACHE, I think I know what you were going for with persisting across discarded renders in relation to the missing lifecycle problem. As we assume the Promise identity to be stable we could hang the value off of that and re-hydrate it though so I think we are safe there. It would have been easier to realise what you were going for with a description for the PR.

JoviDeCroock avatar Dec 02 '25 17:12 JoviDeCroock

Second to @rschristian. use is intentionally designed to be semantically order-insensitive (it's not a real "Hook" in the sense that it doesn't allocate a hook node/slot in the Fiber), so we shouldn't implement it on top of existing order-sensitive hooks.

Huxpro avatar Dec 10 '25 03:12 Huxpro