@codeperate/form-builder-react
Advanced tools
@@ -17,6 +17,18 @@ import { | ||
| export const useFormWidget = <V = any>(path: string) => { | ||
| interface UseFormWidgetOptions { | ||
| syncValue?: boolean; | ||
| syncSchema?: boolean; | ||
| } | ||
| export const useFormWidget = <V = any>( | ||
| path: string, | ||
| options: UseFormWidgetOptions = {} | ||
| ) => { | ||
| const form = useContext(FormContext)!; | ||
| const valueSnap = useSnapshot(form.valueStore); | ||
| const schemaSnap = useSnapshot(form.schemaStore); | ||
| const valueSnap = useSnapshot(form.valueStore, { | ||
| sync: options.syncValue, | ||
| }); | ||
| const schemaSnap = useSnapshot(form.schemaStore, { | ||
| sync: options.syncSchema, | ||
| }); | ||
| const [hasChanged, setHasChanged] = useState(false); | ||
@@ -23,0 +35,0 @@ |
+1
-1
| { | ||
| "name": "@codeperate/form-builder-react", | ||
| "private": false, | ||
| "version": "1.0.16", | ||
| "version": "1.0.17", | ||
| "type": "module", | ||
@@ -6,0 +6,0 @@ "module": "./index.ts", |
@@ -30,3 +30,3 @@ import { FormEvent, memo, useEffect, useRef, useState } from "react"; | ||
| errors, | ||
| } = useFormWidget<string | undefined>(path); | ||
| } = useFormWidget<string | undefined>(path, { syncValue: true }); | ||
@@ -33,0 +33,0 @@ useEffect(() => { |
@@ -33,3 +33,3 @@ import { FormEvent, memo, useEffect, useRef } from "react"; | ||
| errors, | ||
| } = useFormWidget<string | null>(path); | ||
| } = useFormWidget<string | null>(path, { syncValue: true }); | ||
@@ -36,0 +36,0 @@ useEffect(() => { |
@@ -32,3 +32,3 @@ import { FormEvent, memo, useEffect, useRef } from "react"; | ||
| errors, | ||
| } = useFormWidget<string | null>(path); | ||
| } = useFormWidget<string | null>(path, { syncValue: true }); | ||
@@ -35,0 +35,0 @@ useEffect(() => { |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
47758
0.55%1532
0.72%