@saas-ui/forms 2.6.9 → 2.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saas-ui/forms",
3
- "version": "2.6.9",
3
+ "version": "2.6.10",
4
4
  "description": "Fully functional forms for Chakra UI.",
5
5
  "source": "src/index.ts",
6
6
  "exports": {
@@ -33,7 +33,10 @@ const _createField = (
33
33
 
34
34
  const getBaseField = fieldContext?.getBaseField ?? getBaseFieldProp
35
35
 
36
- const { extraProps, BaseField } = getBaseField()
36
+ const { extraProps, BaseField } = React.useMemo(
37
+ () => getBaseField(),
38
+ [getBaseField]
39
+ )
37
40
 
38
41
  const [, inputProps] = splitProps(
39
42
  props,
@@ -1,4 +1,4 @@
1
- import React, { ForwardedRef } from 'react'
1
+ import React, { ForwardedRef, useMemo } from 'react'
2
2
  import { forwardRef } from '@chakra-ui/react'
3
3
 
4
4
  import { FieldsProvider } from './fields-context'
@@ -73,10 +73,13 @@ export function createForm<
73
73
  ...rest
74
74
  } = props
75
75
 
76
- const fieldsContext = {
77
- fields: { ...defaultFieldTypes, ...fields },
78
- getBaseField,
79
- }
76
+ const fieldsContext = useMemo(
77
+ () => ({
78
+ fields: { ...defaultFieldTypes, ...fields },
79
+ getBaseField,
80
+ }),
81
+ [fields, getBaseField]
82
+ )
80
83
 
81
84
  return (
82
85
  <FieldsProvider value={fieldsContext}>