Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/solid-pigs-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/admin.connections.v1": patch
---

Fix rules-of-hooks violation in getFilePicker
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
import { I18n } from "@wso2is/i18n";
import { CopyInputField, GenericIcon, Hint, P12FileStrategy } from "@wso2is/react-components";
import { FormValidation } from "@wso2is/validation";
import React, { ReactElement, useState } from "react";
import React, { ReactElement } from "react";
import { Grid } from "semantic-ui-react";
import { Pkcs12FileField } from "./pkcs12-file-field";
import { ConnectionUIConstants } from "../../../../constants/connection-ui-constants";
Expand Down Expand Up @@ -553,13 +553,13 @@ const getDropDownField = (eachProp: CommonPluggableComponentPropertyInterface,
);
};

/* eslint-disable react-hooks/rules-of-hooks */

const getFilePicker = (eachProp: CommonPluggableComponentPropertyInterface,
propertyMetadata: CommonPluggableComponentMetaPropertyInterface,
testId?: string,
onCertificateChange?: ( newFile: string) => void): ReactElement => {

const [ data, setData ] = useState<string>(eachProp?.value);
const data: string = eachProp?.value ?? "";

return (
<>
Expand Down Expand Up @@ -592,7 +592,6 @@ const getFilePicker = (eachProp: CommonPluggableComponentPropertyInterface,
<Pkcs12FileField
onCertificateChange={ (newData: string) =>
{
setData(newData);
onCertificateChange(data);
} }
/>
Expand Down
Loading