Skip to content

Commit

Permalink
feat: upgrade to zustand v4 (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielkuettel authored Nov 16, 2022
1 parent ea268be commit b9a5b5f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 52 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@
"types": "dist/index.d.ts",
"dependencies": {
"immer": "^9.0.15",
"zustand": "^3.6.5"
"zustand": "^4.1.4"
}
}
41 changes: 0 additions & 41 deletions src/store/middelware/immer.ts

This file was deleted.

11 changes: 5 additions & 6 deletions src/store/state/walletStore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { immer } from "../middelware/immer";
import { immer } from "zustand/middleware/immer";
import create from "zustand";
import { devtools, persist } from "zustand/middleware";
import type { Account } from "../../types";
Expand All @@ -22,10 +22,10 @@ export type WalletStore = {
removeAccounts: (providerId: PROVIDER_ID) => void;
};

export const useWalletStore = create<WalletStore>(
devtools(
export const useWalletStore = create<WalletStore>()(
immer(
persist(
immer((set, _get) => ({
devtools((set, _get) => ({
accounts: [],
activeAccount: null,
setActiveAccount: (account: Account) => {
Expand Down Expand Up @@ -71,7 +71,6 @@ export const useWalletStore = create<WalletStore>(
name: "txnlab-use-wallet", // key in local storage
version: 0, // increment to deprecate stored data
}
),
{ name: "local-storage" } // prefix in Redux DevTools
)
)
);
20 changes: 16 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11701,6 +11701,11 @@ url@^0.11.0:
punycode "1.3.2"
querystring "0.2.0"

[email protected]:
version "1.2.0"
resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a"
integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA==

use@^3.1.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/use/-/use-3.1.1.tgz#d50c8cac79a19fbc20f2911f56eb973f4e10070f"
Expand Down Expand Up @@ -12204,15 +12209,22 @@ yargs@^17.3.1:
y18n "^5.0.5"
yargs-parser "^21.0.0"

yarn.lock@^0.0.1-security:
version "0.0.1-security"
resolved "https://registry.yarnpkg.com/yarn.lock/-/yarn.lock-0.0.1-security.tgz#8e7117924bfe916671b21f14212ba1bb49dfe0c7"
integrity sha512-ZRX6v5zGCJMI1T2aO+BQxJggy1vvorXEwonQhWXIC+brO7lkDB3zWelVNAti183ddH6FmJP8z4UDCJnJlioK4Q==

yocto-queue@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==

zustand@^3.6.5:
version "3.7.2"
resolved "https://registry.yarnpkg.com/zustand/-/zustand-3.7.2.tgz#7b44c4f4a5bfd7a8296a3957b13e1c346f42514d"
integrity sha512-PIJDIZKtokhof+9+60cpockVOq05sJzHCriyvaLBmEJixseQ1a5Kdov6fWZfWOu5SK9c+FhH1jU0tntLxRJYMA==
zustand@^4.1.4:
version "4.1.4"
resolved "https://registry.yarnpkg.com/zustand/-/zustand-4.1.4.tgz#b0286da4cc9edd35e91c96414fa54bfa4652a54d"
integrity sha512-k2jVOlWo8p4R83mQ+/uyB8ILPO2PCJOf+QVjcL+1PbMCk1w5OoPYpAIxy9zd93FSfmJqoH6lGdwzzjwqJIRU5A==
dependencies:
use-sync-external-store "1.2.0"

zwitch@^1.0.0:
version "1.0.5"
Expand Down

0 comments on commit b9a5b5f

Please sign in to comment.