fix: improve ref handling

This commit is contained in:
Daniel Hougaard
2024-12-11 21:51:20 +04:00
parent 422fd27b9a
commit 3b3482b280
2 changed files with 4 additions and 10 deletions

View File

@@ -143,11 +143,8 @@ export const CreateSecretForm = ({
{...secretKeyRegisterRest}
ref={(e) => {
setSecretKeyHookRef(e);
// Can't directly set secretKeyInputRef.current = e, because of read-only property definitions
Object.defineProperty(secretKeyInputRef, "current", {
value: e,
writable: true
});
// @ts-expect-error this is for multiple ref single component
secretKeyInputRef.current = e;
}}
placeholder="Type your secret name"
onPaste={handlePaste}

View File

@@ -206,11 +206,8 @@ export const CreateSecretForm = ({ secretPath = "/", onClose }: Props) => {
{...secretKeyRegisterRest}
ref={(e) => {
setSecretKeyHookRef(e);
// Can't directly set secretKeyInputRef.current = e, because of read-only property definitions
Object.defineProperty(secretKeyInputRef, "current", {
value: e,
writable: true
});
// @ts-expect-error this is for multiple ref single component
secretKeyInputRef.current = e;
}}
placeholder="Type your secret name"
onPaste={handlePaste}