chore: renaming the hook for better understanding

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2023-01-09 15:08:07 +01:00
parent 3c72c0be91
commit 50130d4091
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -409,7 +409,7 @@ export const useCustomFieldExtensions: <
) => TComponentDataType[];
// @alpha
export const useFormData: () => [
export const useFormDataFromQuery: () => [
Record<string, any>,
Dispatch<SetStateAction<Record<string, any>>>,
];
@@ -32,7 +32,7 @@ import { useTemplateSchema } from '../../hooks/useTemplateSchema';
import { ReviewState } from '../ReviewState';
import validator from '@rjsf/validator-ajv6';
import { useFormData } from '../../hooks/useFormData';
import { useFormDataFromQuery } from '../../hooks';
import { FormProps } from '../../types';
const useStyles = makeStyles(theme => ({
@@ -77,7 +77,7 @@ export const Stepper = (props: StepperProps) => {
const { steps } = useTemplateSchema(props.manifest);
const apiHolder = useApiHolder();
const [activeStep, setActiveStep] = useState(0);
const [formState, setFormState] = useFormData();
const [formState, setFormState] = useFormDataFromQuery();
const [errors, setErrors] = useState<
undefined | Record<string, FieldValidation>
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { useFormData } from './useFormData';
export { useFormDataFromQuery } from './useFormDataFromQuery';
export {
useTemplateSchema,
type ParsedTemplateSchema,
@@ -21,7 +21,7 @@ import { useState } from 'react';
* This hook is used to get the formData from the query string.
* @alpha
*/
export const useFormData = () => {
export const useFormDataFromQuery = () => {
return useState<Record<string, any>>(() => {
const query = qs.parse(window.location.search, {
ignoreQueryPrefix: true,