(
- ({ children, text, className, loading, ...other }, ref) => {
+ ({ children, text, className, loading: loadingProp, ...other }, ref) => {
const classPrefix = useFieldClassName('error-message');
+ // we will debounce the loading state to
+ // minimise DOM updates between rapid successive changes
+ // e.g. if the `loading` prop is set based on an instantly fulfilled Promise
+ const loading = useDebouncedValue(loadingProp);
+
if (!children && !text) {
return null;
}
+
return (
-
+
{children || text}
diff --git a/src/components/FieldRepeater/FieldRepeater.stories.tsx b/src/components/FieldRepeater/FieldRepeater.stories.tsx
index 2f3be6f..809463e 100644
--- a/src/components/FieldRepeater/FieldRepeater.stories.tsx
+++ b/src/components/FieldRepeater/FieldRepeater.stories.tsx
@@ -24,12 +24,14 @@ export const StandardUsage = (props: FieldRepeaterProps) => (
label="Name"
name={`${args.name}.name`}
component={Input}
+ disabled={args.disabled}
/>
FieldRepeater children function received arg:{' '}
@@ -54,9 +56,14 @@ StandardUsage.args = {
/**
* 
*
- * The `FieldRepeater` **must** be used within a `