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 store-persistence example #2667

Merged
merged 1 commit into from
Aug 8, 2024
Merged

Fix store-persistence example #2667

merged 1 commit into from
Aug 8, 2024

Conversation

jeppester
Copy link
Contributor

@jeppester jeppester commented Aug 7, 2024

I spent way too much time on figuring out why my state was empty.
I hope this change will save that time for other devs.

Calling setHasHydrated directly in onRehydrateStorage causes the state to only contain the { _hasHydrated: true } rather than the actual hydrated state (which I believe is then lost).

setHasHydrated must instead be called from the function returned from onRehydrateStorage, as that function will be called after the state has been hydrated.

Related Bug Reports or Discussions

Fixes #

Summary

Check List

  • pnpm run prettier for formatting code and docs

Calling `setHasHydrated` directly in `onRehydrateStorage` causes the state to only contain the `{ _hasHydrated: true }` rather than the actual hydrated state (which I believe will be lost).

`setHasHydrated` must instead be called from the function returned from  `onRehydrateStorage`, as that function will be called after the state has been hydrated.
Copy link

vercel bot commented Aug 7, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
zustand-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 7, 2024 0:43am

Copy link

codesandbox-ci bot commented Aug 7, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
Collaborator

@dbritto-dev dbritto-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dbritto-dev dbritto-dev merged commit 2875d07 into pmndrs:main Aug 8, 2024
39 checks passed
@jeppester jeppester deleted the patch-1 branch August 8, 2024 04:37
kodiakhq bot pushed a commit to weareinreach/InReach that referenced this pull request Aug 15, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change | OpenSSF | Age | Adoption | Passing
| Confidence |
|---|---|---|---|---|---|---|---|---|
|
[@aws-sdk/client-cognito-identity-provider](https://togithub.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity-provider)
([source](https://togithub.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-cognito-identity-provider))
| dependencies | minor | [`3.629.0` ->
`3.631.0`](https://renovatebot.com/diffs/npm/@aws-sdk%2fclient-cognito-identity-provider/3.629.0/3.631.0)
| [![OpenSSF
Scorecard](https://api.securityscorecards.dev/projects/github.com/aws/aws-sdk-js-v3/badge)](https://securityscorecards.dev/viewer/?uri=github.com/aws/aws-sdk-js-v3)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@aws-sdk%2fclient-cognito-identity-provider/3.631.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@aws-sdk%2fclient-cognito-identity-provider/3.631.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@aws-sdk%2fclient-cognito-identity-provider/3.629.0/3.631.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@aws-sdk%2fclient-cognito-identity-provider/3.629.0/3.631.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [chromatic](https://www.chromatic.com)
([source](https://togithub.com/chromaui/chromatic-cli)) |
devDependencies | patch | [`11.7.0` ->
`11.7.1`](https://renovatebot.com/diffs/npm/chromatic/11.7.0/11.7.1) |
[![OpenSSF
Scorecard](https://api.securityscorecards.dev/projects/github.com/chromaui/chromatic-cli/badge)](https://securityscorecards.dev/viewer/?uri=github.com/chromaui/chromatic-cli)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/chromatic/11.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/chromatic/11.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/chromatic/11.7.0/11.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/chromatic/11.7.0/11.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [chromatic](https://www.chromatic.com)
([source](https://togithub.com/chromaui/chromatic-cli)) | dependencies |
patch | [`11.7.0` ->
`11.7.1`](https://renovatebot.com/diffs/npm/chromatic/11.7.0/11.7.1) |
[![OpenSSF
Scorecard](https://api.securityscorecards.dev/projects/github.com/chromaui/chromatic-cli/badge)](https://securityscorecards.dev/viewer/?uri=github.com/chromaui/chromatic-cli)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/chromatic/11.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/chromatic/11.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/chromatic/11.7.0/11.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/chromatic/11.7.0/11.7.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js)
| dependencies | patch | [`1.11.5` ->
`1.11.7`](https://renovatebot.com/diffs/npm/libphonenumber-js/1.11.5/1.11.7)
| |
[![age](https://developer.mend.io/api/mc/badges/age/npm/libphonenumber-js/1.11.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/libphonenumber-js/1.11.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/libphonenumber-js/1.11.5/1.11.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/libphonenumber-js/1.11.5/1.11.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js)
| devDependencies | patch | [`1.11.5` ->
`1.11.7`](https://renovatebot.com/diffs/npm/libphonenumber-js/1.11.5/1.11.7)
| |
[![age](https://developer.mend.io/api/mc/badges/age/npm/libphonenumber-js/1.11.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/libphonenumber-js/1.11.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/libphonenumber-js/1.11.5/1.11.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/libphonenumber-js/1.11.5/1.11.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[nextjs-google-analytics](https://togithub.com/MauricioRobayo/nextjs-google-analytics)
| peerDependencies | patch | [`2.3.3` ->
`2.3.7`](https://renovatebot.com/diffs/npm/nextjs-google-analytics/2.3.3/2.3.7)
| [![OpenSSF
Scorecard](https://api.securityscorecards.dev/projects/github.com/MauricioRobayo/nextjs-google-analytics/badge)](https://securityscorecards.dev/viewer/?uri=github.com/MauricioRobayo/nextjs-google-analytics)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/nextjs-google-analytics/2.3.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/nextjs-google-analytics/2.3.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/nextjs-google-analytics/2.3.3/2.3.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/nextjs-google-analytics/2.3.3/2.3.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[nextjs-google-analytics](https://togithub.com/MauricioRobayo/nextjs-google-analytics)
| devDependencies | patch | [`2.3.3` ->
`2.3.7`](https://renovatebot.com/diffs/npm/nextjs-google-analytics/2.3.3/2.3.7)
| [![OpenSSF
Scorecard](https://api.securityscorecards.dev/projects/github.com/MauricioRobayo/nextjs-google-analytics/badge)](https://securityscorecards.dev/viewer/?uri=github.com/MauricioRobayo/nextjs-google-analytics)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/nextjs-google-analytics/2.3.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/nextjs-google-analytics/2.3.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/nextjs-google-analytics/2.3.3/2.3.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/nextjs-google-analytics/2.3.3/2.3.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
|
[nextjs-google-analytics](https://togithub.com/MauricioRobayo/nextjs-google-analytics)
| dependencies | patch | [`2.3.3` ->
`2.3.7`](https://renovatebot.com/diffs/npm/nextjs-google-analytics/2.3.3/2.3.7)
| [![OpenSSF
Scorecard](https://api.securityscorecards.dev/projects/github.com/MauricioRobayo/nextjs-google-analytics/badge)](https://securityscorecards.dev/viewer/?uri=github.com/MauricioRobayo/nextjs-google-analytics)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/nextjs-google-analytics/2.3.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/nextjs-google-analytics/2.3.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/nextjs-google-analytics/2.3.3/2.3.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/nextjs-google-analytics/2.3.3/2.3.7?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [zustand](https://togithub.com/pmndrs/zustand) | dependencies | patch
| [`4.5.4` ->
`4.5.5`](https://renovatebot.com/diffs/npm/zustand/4.5.4/4.5.5) |
[![OpenSSF
Scorecard](https://api.securityscorecards.dev/projects/github.com/pmndrs/zustand/badge)](https://securityscorecards.dev/viewer/?uri=github.com/pmndrs/zustand)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/zustand/4.5.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/zustand/4.5.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/zustand/4.5.4/4.5.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/zustand/4.5.4/4.5.5?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>aws/aws-sdk-js-v3
(@&#8203;aws-sdk/client-cognito-identity-provider)</summary>

###
[`v3.631.0`](https://togithub.com/aws/aws-sdk-js-v3/blob/HEAD/clients/client-cognito-identity-provider/CHANGELOG.md#36310-2024-08-14)

[Compare
Source](https://togithub.com/aws/aws-sdk-js-v3/compare/v3.629.0...v3.631.0)

**Note:** Version bump only for package
[@&#8203;aws-sdk/client-cognito-identity-provider](https://togithub.com/aws-sdk/client-cognito-identity-provider)

</details>

<details>
<summary>chromaui/chromatic-cli (chromatic)</summary>

###
[`v11.7.1`](https://togithub.com/chromaui/chromatic-cli/blob/HEAD/CHANGELOG.md#v1171-Wed-Aug-14-2024)

[Compare
Source](https://togithub.com/chromaui/chromatic-cli/compare/v11.7.0...v11.7.1)

##### 🐛 Bug Fix

- Add key to configuration to fix
[#&#8203;1022](https://togithub.com/chromaui/chromatic-cli/issues/1022)
[#&#8203;1023](https://togithub.com/chromaui/chromatic-cli/pull/1023)
([@&#8203;winkerVSbecks](https://togithub.com/winkerVSbecks))

##### Authors: 1

- Varun Vachhar
([@&#8203;winkerVSbecks](https://togithub.com/winkerVSbecks))

***

</details>

<details>
<summary>catamphetamine/libphonenumber-js (libphonenumber-js)</summary>

###
[`v1.11.7`](https://gitlab.com/catamphetamine/libphonenumber-js/compare/v1.11.6...v1.11.7)

[Compare
Source](https://gitlab.com/catamphetamine/libphonenumber-js/compare/v1.11.6...v1.11.7)

###
[`v1.11.6`](https://gitlab.com/catamphetamine/libphonenumber-js/compare/v1.11.5...372ebdf546c73f6e375bede21b53da2f969df53c)

[Compare
Source](https://gitlab.com/catamphetamine/libphonenumber-js/compare/v1.11.5...v1.11.6)

</details>

<details>
<summary>MauricioRobayo/nextjs-google-analytics
(nextjs-google-analytics)</summary>

###
[`v2.3.7`](https://togithub.com/MauricioRobayo/nextjs-google-analytics/releases/tag/v2.3.7)

[Compare
Source](https://togithub.com/MauricioRobayo/nextjs-google-analytics/compare/v2.3.3...v2.3.7)

##### Bug Fixes

- install dependencies before release
([abb0c6f](https://togithub.com/MauricioRobayo/nextjs-google-analytics/commit/abb0c6f8cfe02102213de225cfc769317c7f9801))

</details>

<details>
<summary>pmndrs/zustand (zustand)</summary>

### [`v4.5.5`](https://togithub.com/pmndrs/zustand/releases/tag/v4.5.5)

[Compare
Source](https://togithub.com/pmndrs/zustand/compare/v4.5.4...v4.5.5)

This improves the `persist` middleware behavior for an edge case.

#### What's Changed

- fix(storage): avoid calling setItem with the state just retrieved by
[@&#8203;double-thinker](https://togithub.com/double-thinker) in
[pmndrs/zustand#2678
- chore(deps): update dependencies by
[@&#8203;dai-shi](https://togithub.com/dai-shi) in
[pmndrs/zustand#2680

#### New Contributors

- [@&#8203;alwalxed](https://togithub.com/alwalxed) made their first
contribution in
[pmndrs/zustand#2634
- [@&#8203;YashChauhan858](https://togithub.com/YashChauhan858) made
their first contribution in
[pmndrs/zustand#2636
- [@&#8203;donutcube](https://togithub.com/donutcube) made their first
contribution in
[pmndrs/zustand#2650
- [@&#8203;vorant94](https://togithub.com/vorant94) made their first
contribution in
[pmndrs/zustand#2661
- [@&#8203;jeppester](https://togithub.com/jeppester) made their first
contribution in
[pmndrs/zustand#2667
- [@&#8203;ryota-murakami](https://togithub.com/ryota-murakami) made
their first contribution in
[pmndrs/zustand#2668
- [@&#8203;double-thinker](https://togithub.com/double-thinker) made
their first contribution in
[pmndrs/zustand#2678

**Full Changelog**:
pmndrs/zustand@v4.5.4...v4.5.5

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job
log](https://developer.mend.io/github/weareinreach/InReach).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4yNi4xIiwidXBkYXRlZEluVmVyIjoiMzguMjYuMSIsInRhcmdldEJyYW5jaCI6ImRldiIsImxhYmVscyI6WyJhdXRvbWVyZ2UiLCJkZXBlbmRlbmNpZXMiLCJrb2RpYWs6IG1lcmdlLm1ldGhvZCA9ICdzcXVhc2gnIl19-->


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit


- **New Features**
- Updated multiple dependencies to their latest versions, potentially
introducing performance improvements and new features.

- **Bug Fixes**
- Minor version updates across several packages may include bug fixes
and enhancements, improving overall application stability.

- **Chores**
- Regular maintenance performed through dependency updates to ensure the
application remains secure and efficient.


<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

2 participants