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

rm-hull / use-local-storage / 18985012008
92%

Build:
DEFAULT BRANCH: main
Ran 31 Oct 2025 08:57PM UTC
Jobs 1
Files 2
Run time 1min
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

31 Oct 2025 08:57PM UTC coverage: 92.308% (+0.4%) from 91.954%
18985012008

push

github

web-flow
feat: add initialValue option to useLocalStorage (#35)

* refactor: Add T constraint to useLocalStorage

The generic type `T` used in `useLocalStorage` is now constrained
to ensure it is a `Record<string, unknown>` or `undefined`. This
improves type safety and clarity.

* feat: add initialValue option to useLocalStorage

Introduces the `initialValue` option to allow providing a
default value if the key is not present in `localStorage`.

This value is used only when the stored item is initially
empty (`null`). If a deserialization error occurs, the value
will remain `undefined` regardless of this option.

* fix: Initialize stored value as empty object

This commit refines how `useLocalStorage` handles the internal stored
value when it is initially `undefined`.

*   Ensure the base object used for updates defaults to `{}` instead
    of relying on `options?.initialValue`. This prevents errors when
    attempting to spread properties onto a non-object base state.
*   Removed `options?.initialValue` from `useEffect` dependencies.
*   Added a type assertion when retrieving the specific key's value.

* Add changeset record

25 of 30 branches covered (83.33%)

Branch coverage included in aggregate %.

59 of 61 relevant lines covered (96.72%)

48.75 hits per line

Jobs
ID Job ID Ran Files Coverage
1 18985012008.1 31 Oct 2025 08:57PM UTC 2
92.31
GitHub Action Run
Source Files on build 18985012008
  • Tree
  • List 2
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Github Actions Build #18985012008
  • bc02ee82 on github
  • Prev Build on main (#18984742019)
  • Next Build on main (#18985522182)
  • Delete
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