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

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

Build:
DEFAULT BRANCH: main
Ran 31 Oct 2025 06:32PM 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 06:32PM UTC coverage: 91.954% (+1.8%) from 90.123%
18981841665

push

github

web-flow
feat: Expose errors via state in `useLocalStorage` (#31)

* feat: Expose errors via state in useLocalStorage

This introduces explicit error reporting for storage operations
in `useLocalStorage`.

Instead of relying on silent `console.error` logging, storage
failures (serialization, deserialization, or storage access)
are now:

*   Wrapped in a custom `LocalStorageError` class.
*   Exposed via the new `error` property returned by the hook.

* fix: Clear error state upon successful read

Ensures that the internal error state is cleared if a successful
value read occurs (e.g., after an external update corrects a
previously corrupt entry).

Includes new tests verifying:
*   Error clearing behavior.
*   Error handling when the `serializer` fails during `setValue`.

* test: Improve error tests for useLocalStorage

Refactors existing error tests and adds coverage for failures
during the initial read phase (deserialization).

This ensures that when a custom serializer fails during
`deserialize`, the `useLocalStorage` hook correctly handles
the error:

*   Sets `result.current.error` to `LocalStorageError`.
*   Includes the underlying serialization error as the `cause`.
*   Keeps `result.current.value` as `undefined`.

* docs: Show error handling in README example

Added a demonstration of how to check for and render potential
`error` states returned by `useLocalStorage` within the Basic Counter
example.

Also reordered sections in the README for better content flow.

* docs: Add link to crypto-js in README

Adds a direct link to the recommended external
library `crypto-js` within the custom serializer
example section of the `README.md`.

21 of 26 branches covered (80.77%)

Branch coverage included in aggregate %.

12 of 12 new or added lines in 2 files covered. (100.0%)

59 of 61 relevant lines covered (96.72%)

46.31 hits per line

Jobs
ID Job ID Ran Files Coverage
1 18981841665.1 31 Oct 2025 06:32PM UTC 2
91.95
GitHub Action Run
Source Files on build 18981841665
  • 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 #18981841665
  • 0dfb8e9d on github
  • Prev Build on main (#18979844385)
  • Next Build on main (#18981958961)
  • 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