Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#785): update useStorage to use createGlobalState #1025

Closed
wants to merge 274 commits into from

Conversation

nspaeth
Copy link

@nspaeth nspaeth commented Mar 5, 2020

Description

Fixes #785 - useLocalStorage not updating if many components watch the same key

Previously pr #786 addressed this issue by ensuring that other components
watching the key would see new updates, however, those updates would not be
rendered until something else triggered a re-render. This pr resolves that issue.

This pull request depends on pull requests #1021 #979

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as before)

Checklist

  • Read the Contributing Guide
  • Perform a code self-review
  • Comment the code, particularly in hard-to-understand areas
  • Add documentation
  • Add hook's story at Storybook
  • Cover changes with tests
  • Ensure the test suite passes (yarn test)
  • Provide 100% tests coverage
  • Make sure code lints (yarn lint). Fix it with yarn lint:fix in case of failure.
  • Make sure types are fine (yarn lint:types).

@nspaeth nspaeth force-pushed the pr/fix-785 branch 6 times, most recently from 0ca1c4c to 635f2f3 Compare March 6, 2020 18:39
renovate-bot and others added 20 commits June 12, 2020 10:03
fix: 🐛 improve how text is dropped in useDrop hook
## [15.2.3](streamich/react-use@v15.2.2...v15.2.3) (2020-06-13)

### Bug Fixes

* 🐛 improve how text is dropped in useDrop hook ([b2f46d1](streamich@b2f46d1))
## [15.2.4](streamich/react-use@v15.2.3...v15.2.4) (2020-06-13)

### Bug Fixes

*  doesn't unlock the body on unmount ([1ead4ef](streamich@1ead4ef))
## [15.2.5](streamich/react-use@v15.2.4...v15.2.5) (2020-06-15)

### Bug Fixes

* bump react-universal-interface ([1540c1a](streamich@1540c1a))
Better to use two-variables exchange than `useEffect` with new
function on each render.
feat(usePrevious): reworked the hook, now it is more memory-efficient.
# [15.3.0](streamich/react-use@v15.2.5...v15.3.0) (2020-06-19)

### Features

* **usePrevious:** reworked the hook, now it is more memory-efficient. ([8c6f467](streamich@8c6f467))
This commit adds support for functional updates to align with the React.useState
API. Type definitions are updated to match useState.

This might break existing code that expects functions to be held in the global
state, rather than applied as an update.

This change may also cause new type errors.
nspaeth and others added 5 commits June 20, 2020 14:32
Makes the call synchronous to avoid race conditions, and works with SSR.
See comment at:
streamich#1060 (comment)
…es and folder

--uses the base storage, that we can re-used for localStorage and sessionStorage, because they have he same signature
-Added the sessionStorage unit test
-Update the docs that describe about the config changes, for raw, serializer, de-serializer
Fixes streamich#785 - useLocalStorage not updating if many components watch the same key

Previously pr streamich#786 addressed this issue by ensuring that other components
watching the key would see new updates, however, those updates would not be
rendered until something else triggered a re-render. This pr resolves that issue.

This pull request depends on pull requests streamich#1021 streamich#979
@streamich streamich deleted the branch streamich:v14.0 June 30, 2023 14:37
@streamich streamich closed this Jun 30, 2023
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.