Compare commits

..

No commits in common. "6f8735d03e9acb7ea331a0c0a932386d5f9e4922" and "bce58aade697c41c0240af2aa04f0c6b4e69c7c3" have entirely different histories.

View File

@ -1,4 +1,4 @@
import { useEffect, useState } from "react";
import { useState } from "react";
import {
useAssignOrgToTenant,
useOrganizationBySPRID,
@ -14,14 +14,12 @@ import { OrgCardSkeleton } from "./OrganizationSkeleton";
// Zod schema: only allow exactly 4 digits
const OrgPickerFromSPId = ({ title, placeholder }) => {
const { onClose, startStep, flowType, onOpen, prevStep, orgData } =
const { onClose, startStep, flowType, onOpen, prevStep } =
useOrganizationModal();
const {
register,
handleSubmit,
setValue,
formState: { errors },
watch,
} = useForm({
@ -38,24 +36,7 @@ const OrgPickerFromSPId = ({ title, placeholder }) => {
setSPRID(formdata.spridSearchText);
};
// Add this..
useEffect(() => {
if (orgData?.sprid) {
setValue("spridSearchText", orgData.sprid);
setSPRID(orgData.sprid);
}
}, [orgData, setValue]);
// Add this..
useEffect(() => {
const subscription = watch((value) => {
if (!value.spridSearchText) {
setSPRID("");
}
});
return () => subscription.unsubscribe();
}, [watch]);
const handleOrg = (orgId) => { };
const handleOrg = (orgId) => {};
const SP = watch("spridSearchText");
return (
<div className="d-block">