@logux/client
Advanced tools
Comparing version 0.13.1 to 0.13.2
{ | ||
"name": "@logux/client", | ||
"version": "0.13.1", | ||
"version": "0.13.2", | ||
"description": "Logux base components to build web client", | ||
@@ -36,3 +36,3 @@ "keywords": [ | ||
"react-dom": ">=16.8.0", | ||
"vue": ">=3.1.1" | ||
"vue": ">=3.2.4" | ||
}, | ||
@@ -58,4 +58,4 @@ "peerDependenciesMeta": { | ||
"nanoevents": "^6.0.0", | ||
"nanoid": "^3.1.23" | ||
"nanoid": "^3.1.24" | ||
} | ||
} |
@@ -14,3 +14,7 @@ import { useState, useContext, useEffect, useRef } from 'preact/hooks' | ||
export function useClient() { | ||
return useContext(ClientContext) | ||
let client = useContext(ClientContext) | ||
if (process.env.NODE_ENV !== 'production' && !client) { | ||
throw new Error('Wrap components in Logux <ClientContext.Provider>') | ||
} | ||
return client | ||
} | ||
@@ -22,16 +26,3 @@ | ||
let value | ||
if (process.env.NODE_ENV === 'production') { | ||
value = getValue(store) | ||
} else { | ||
try { | ||
value = getValue(store) | ||
} catch (e) { | ||
if (e.message === 'Missed Logux client') { | ||
throw new Error('Wrap components in Logux <ClientContext.Provider>') | ||
} else { | ||
throw e | ||
} | ||
} | ||
} | ||
let value = getValue(store) | ||
@@ -38,0 +29,0 @@ if (process.env.NODE_ENV !== 'production') { |
@@ -13,3 +13,7 @@ import { useStore, batch } from 'nanostores/react' | ||
export function useClient() { | ||
return React.useContext(ClientContext) | ||
let client = React.useContext(ClientContext) | ||
if (process.env.NODE_ENV !== 'production' && !client) { | ||
throw new Error('Wrap components in Logux <ClientContext.Provider>') | ||
} | ||
return client | ||
} | ||
@@ -20,18 +24,4 @@ | ||
let [, forceRender] = React.useState({}) | ||
let value = getValue(store) | ||
let value | ||
if (process.env.NODE_ENV === 'production') { | ||
value = getValue(store) | ||
} else { | ||
try { | ||
value = getValue(store) | ||
} catch (e) { | ||
if (e.message === 'Missed Logux client') { | ||
throw new Error('Wrap components in Logux <ClientContext.Provider>') | ||
} else { | ||
throw e | ||
} | ||
} | ||
} | ||
if (process.env.NODE_ENV !== 'production') { | ||
@@ -38,0 +28,0 @@ let errorProcessors = React.useContext(ErrorsContext) || {} |
@@ -34,3 +34,10 @@ import { | ||
export function useClient() { | ||
return inject(ClientKey) | ||
let client = inject(ClientKey) | ||
if (process.env.NODE_ENV !== 'production' && !client) { | ||
throw new Error( | ||
`Install Logux Client using loguxPlugin: ` + | ||
`app.use(loguxPlugin, client).` | ||
) | ||
} | ||
return client | ||
} | ||
@@ -57,18 +64,3 @@ | ||
if (process.env.NODE_ENV === 'production') { | ||
unsubscribe = store.subscribe(listener) | ||
} else { | ||
try { | ||
unsubscribe = store.subscribe(listener) | ||
} catch (e) { | ||
if (e.message === 'Missed Logux client') { | ||
throw new Error( | ||
`Install Logux Client using loguxPlugin: ` + | ||
`app.use(loguxPlugin, client).` | ||
) | ||
} else { | ||
throw e | ||
} | ||
} | ||
} | ||
unsubscribe = store.subscribe(listener) | ||
@@ -75,0 +67,0 @@ if (store.loading) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
146460
4898
Updatednanoid@^3.1.24