New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

circle-ihk

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

circle-ihk - npm Package Compare versions

Comparing version 1.0.0-10 to 1.0.0-11

5

dist/hook/useOption.d.ts

@@ -0,6 +1,6 @@

/// <reference types="react" />
interface IProps {
id: string;
id?: string;
defaultValue: any;
disabled?: boolean;
monitorFields?: boolean;
}

@@ -12,2 +12,3 @@ export default function useOption(props: IProps): {

refetch: () => void;
setValue: import("react").Dispatch<any>;
onChange: (value: any, callback?: ((error?: string) => void) | undefined) => void;

@@ -14,0 +15,0 @@ container: HTMLElement;

37

dist/hook/useOption.js
import useApp from './useApp';
import { useState, useEffect } from 'react';
import { isUndefined, isFunction, isObject } from '../utils/is';
import { isUndefined, isFunction } from '../utils/is';
export default function useOption(props) {
const { id, disabled, defaultValue, monitorFields = true } = props;
const { id, disabled, defaultValue } = props;
const { app, me, container } = useApp();

@@ -36,24 +36,18 @@ const [value, setValue] = useState(defaultValue);

};
useEffect(refetch, [id]);
useEffect(() => {
if (!monitorFields || !isObject(defaultValue)) {
return;
return app.on('tab_activated', (visible) => {
visible && refetch();
});
}, []);
useEffect(() => {
refetch();
let fieldToListen = `${id}_option`;
if (!id || id === 'option') {
fieldToListen = `${me.id}_option`;
}
const keysToMonitor = Object.keys(defaultValue);
if (keysToMonitor.length <= 0) {
return;
else if (id === 'display') {
fieldToListen = `${me.id}_display_option`;
}
const hooksToMonitor = [];
keysToMonitor.forEach((key) => {
hooksToMonitor.push(app.on(`${['option', 'display'].includes(id) ? me.id : id}_${key}`, refetch));
});
return () => {
if (hooksToMonitor.length <= 0) {
return;
}
hooksToMonitor.forEach((hookToMonitor) => {
hookToMonitor();
});
};
}, [me.id, monitorFields, defaultValue, refetch]);
return app.on(fieldToListen, refetch);
}, [id]);
return {

@@ -64,2 +58,3 @@ me,

refetch,
setValue,
onChange,

@@ -66,0 +61,0 @@ container,

@@ -19,6 +19,6 @@ import { useRef, useState, useEffect } from 'react';

}
if (results.length <= 0 || results.length < query.limit) {
if (results.length <= 0 || results.length < limit) {
done.current = true;
}
if (query.start <= 1) {
if (start <= 1) {
setData(results);

@@ -25,0 +25,0 @@ }

{
"name": "circle-ihk",
"version": "1.0.0-10",
"version": "1.0.0-11",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Circle Reader Component Library",

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