Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

refactor: resolve zustand v4 deprecations

thecodrrf81b62a8fc87
diff --git a/apps/web/src/common/store.js b/apps/web/src/common/store.js
index 1b009090c..078397fc9 100644
--- a/apps/web/src/common/store.js
+++ b/apps/web/src/common/store.js
@@ -1,6 +1,7 @@
import produce, { immerable, setAutoFreeze } from "immer";
import create from "zustand";
setAutoFreeze(false);
+
function immer(config) {
return function (set, get, api) {
const obj = config(
@@ -22,8 +23,8 @@ function immer(config) {
* @returns {[import("zustand").UseStore<any>, any]}
*/
function createStore(store) {
- const [useStore, api] = create(immer(store.new.bind(store)));
- return [useStore, api.getState()];
+ const useStore = create(immer(store.new.bind(store)));
+ return [useStore, useStore.getState()];
}
export default createStore;
diff --git a/apps/web/src/stores/index.js b/apps/web/src/stores/index.js
index cca514ac6..b94a187e0 100644
--- a/apps/web/src/stores/index.js
+++ b/apps/web/src/stores/index.js
@@ -6,7 +6,6 @@ class BaseStore {
constructor(set, get) {
this.set = set;
this.get = get;
- this.id = Math.random();
}
}