aboutsummaryrefslogtreecommitdiff
path: root/packages/taler-wallet-webextension/src/mui
diff options
context:
space:
mode:
Diffstat (limited to 'packages/taler-wallet-webextension/src/mui')
-rw-r--r--packages/taler-wallet-webextension/src/mui/input/FormControl.tsx10
-rw-r--r--packages/taler-wallet-webextension/src/mui/input/InputBase.tsx2
2 files changed, 8 insertions, 4 deletions
diff --git a/packages/taler-wallet-webextension/src/mui/input/FormControl.tsx b/packages/taler-wallet-webextension/src/mui/input/FormControl.tsx
index 8860ce20d..0f73f8c02 100644
--- a/packages/taler-wallet-webextension/src/mui/input/FormControl.tsx
+++ b/packages/taler-wallet-webextension/src/mui/input/FormControl.tsx
@@ -1,6 +1,6 @@
import { css } from "@linaria/core";
import { ComponentChildren, createContext, h, VNode } from "preact";
-import { useContext, useState } from "preact/hooks";
+import { useContext, useMemo, useState } from "preact/hooks";
// eslint-disable-next-line import/extensions
import { Colors } from "../style";
@@ -152,6 +152,10 @@ function withoutUndefinedProperties(obj: any): any {
export function useFormControl(props: Partial<FCCProps> = {}): FCCProps {
const ctx = useContext(FormControlContext);
const cleanedProps = withoutUndefinedProperties(props);
- if (!ctx) return { ...defaultContextValue, ...cleanedProps };
- return { ...ctx, ...cleanedProps };
+
+ return useMemo(() => {
+ return !ctx
+ ? { ...defaultContextValue, ...cleanedProps }
+ : { ...ctx, ...cleanedProps };
+ }, [cleanedProps, ctx]);
}
diff --git a/packages/taler-wallet-webextension/src/mui/input/InputBase.tsx b/packages/taler-wallet-webextension/src/mui/input/InputBase.tsx
index a25366bd2..a71f11c5e 100644
--- a/packages/taler-wallet-webextension/src/mui/input/InputBase.tsx
+++ b/packages/taler-wallet-webextension/src/mui/input/InputBase.tsx
@@ -169,7 +169,7 @@ export function InputBase({
} else {
fcs.onEmpty();
}
- }, [value]);
+ }, [value, fcs]);
const handleFocus = (event: JSX.TargetedFocusEvent<EventTarget>): void => {
// Fix a bug with IE11 where the focus/blur events are triggered