• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

preactjs / preact / 5574 / 1
100%
master: 100%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 04 Oct 2019 09:50AM UTC
Files 20
Run time 1s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

04 Oct 2019 09:47AM UTC coverage: 99.524% (-0.2%) from 99.764%
5574.1

push

travis-ci

JoviDeCroock
Reduce size of adding hooks to core (-117 B) (#1976)

* Add a couple missing types to index.d.ts

* Replace globalHookState with resetHookState function (-70 B)

Our terser config only mangles properties that begin with "_" so the
globalHookState properties weren't being mangled. Adding "_" before each
property name reduced the size by 28 B.

However instead of just mangling the property names, I made the variables local
to the hooks file and exposed the functionality that diff/index.js needs
as a function to modify the hook state. Since the variables are now
local to hooks, they can be minified like local variables bringing
additional savings

* Fix bug introduced by descturcturing useImperativeHandle hook state (+2 B)

Destructuring an object's properties does not propagate changes to the
local variable to the original object which broke useImperativeHandle.
Add test to verify behavior

* Reuse vnode._component null check in unmount to call hook cleanup callbacks (-5 B)

Actually increases our compat with React cuz refs are nullified before calling hook cleanup functions:
https://codesandbox.io/s/unmounting-refs-and-effects-jo4g2

* Move pendingLayoutEffects flush into component diff to reuse "c" variable (-12 B)

* Minify useImperativeHandle hook state props (-10 B)

* Schedule imperative handle creation as a layout effect (-31 B)

Technically this is slightly different than React cuz layout effects and imperative handle creation within a component will be inter-mixed. In React, imperative handle always comes before layout effects. I think this compromise is okay though, cuz I don't think imperative handles are supposed to be used by the component that creates them, but rather by the parent component that owns the ref useImperativeHandle is modifying.

* Fix useContext args change check (+9 B)

The previous change to destructure the args of getHookState broke because `state._value` was no longer modified. Instead ... (continued)

810 of 837 branches covered (96.77%)

837 of 841 relevant lines covered (99.52%)

788.92 hits per line

Source Files on job 5574.1
  • Tree
  • List 0
  • Changed 12
  • Source Changed 4
  • Coverage Changed 12
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 1046
  • Travis Job 5574.1
  • 22e051d4 on github
  • Prev Job for on feat/hooks-in-core (#5546.1)
  • Next Job for on feat/hooks-in-core (#5578.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc