Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cra-template-demplate

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cra-template-demplate - npm Package Compare versions

Comparing version 0.2.0 to 0.2.1

template/src/utils/syncMiddleware.ts

2

package.json
{
"name": "cra-template-demplate",
"version": "0.2.0",
"version": "0.2.1",
"keywords": [

@@ -5,0 +5,0 @@ "react",

@@ -1,2 +0,3 @@

import {applyMiddleWares, logMiddleware, persistMiddlewareCreator, StoreInterface} from '@/utils/zustand';
import {applyMiddleware, logMiddleware, StoreInterface} from '@/utils/zustand';
import {syncMiddlewareCreator} from '@/utils/syncMiddleware';

@@ -22,7 +23,8 @@ export enum Locale {

export const useLocaleStore = applyMiddleWares<Store>(store, [
persistMiddlewareCreator({
name: 'locale'
export const useLocaleStore = applyMiddleware<Store>(store, [
syncMiddlewareCreator({
name: 'locale',
syncDynamically: true
}),
logMiddleware
]);

@@ -1,2 +0,2 @@

import {applyMiddleWares, logMiddleware, StoreInterface} from '@/utils/zustand';
import {applyMiddleware, logMiddleware, StoreInterface} from '@/utils/zustand';
import {sleep} from '@/utils';

@@ -30,5 +30,5 @@ import {testMiddleware} from '@/middleware/test';

export const useTestStore = applyMiddleWares<Test>(store, [
export const useTestStore = applyMiddleware<Test>(store, [
logMiddleware,
testMiddleware
]);
import create, {GetState, SetState, StateCreator, StoreApi} from 'zustand';
import {persist, PersistOptions} from 'zustand/middleware';
import {log} from '@/utils/index';

@@ -16,3 +15,3 @@

export const applyMiddleWares = <T extends {}>(s: StoreInterface<T>, middlewares: Middleware<T>[]) => create<T>(
export const applyMiddleware = <T extends {}>(s: StoreInterface<T>, middlewares: Middleware<T>[]) => create<T>(
middlewares.reduce((a, m) => m(a), s)

@@ -31,3 +30,1 @@ );

}, get, store, $$storeMutations);
export const persistMiddlewareCreator = <T extends {}>(options: PersistOptions<T>) => (s: StoreInterface<T>) => persist<T>(s, options);
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc