diff --git a/forms-flow-admin/src/index.tsx b/forms-flow-admin/src/index.tsx index 9bc65fce..e30f188e 100644 --- a/forms-flow-admin/src/index.tsx +++ b/forms-flow-admin/src/index.tsx @@ -62,6 +62,12 @@ const Admin = React.memo(({ props }: any) => { } }, []); + React.useEffect(()=>{ + if(instance){ + publish("FF_AUTH", instance); + } + },[instance]) + React.useEffect(()=>{ if(!isAuth) return const locale = localStorage.getItem("i18nextLng") diff --git a/forms-flow-components/src/components/CustomComponents/ImportModal.tsx b/forms-flow-components/src/components/CustomComponents/ImportModal.tsx index 1795cdc3..bd41b8a5 100644 --- a/forms-flow-components/src/components/CustomComponents/ImportModal.tsx +++ b/forms-flow-components/src/components/CustomComponents/ImportModal.tsx @@ -76,6 +76,7 @@ export const ImportModal: React.FC = React.memo( const redColor = computedStyle.getPropertyValue("--ff-red-000"); const [selectedFile, setSelectedFile] = useState(null); const [uploadProgress, setUploadProgress] = useState(0); + const hasVersion = (item) => item?.majorVersion != null || item?.minorVersion != null; const skipImport = "Skip, do not import"; const [selectedLayoutVersion, setSelectedLayoutVersion] = useState<{ value: any; @@ -160,34 +161,27 @@ export const ImportModal: React.FC = React.memo( }; - const primaryButtonDisabled = - !selectedFile || - inprogress || + const primaryButtonDisabled = + !selectedFile || + inprogress || importLoader || - (importError && primaryButtonText !== "Try Again") || - (showFileItems && - selectedFlowVersion?.label === skipImport && + (importError && primaryButtonText !== "Try Again") || + (showFileItems && + fileItems && + selectedFlowVersion?.label === skipImport && selectedLayoutVersion?.label === skipImport); - useEffect(() => { - if ( - fileItems && - !importError && - Object.values(fileItems).some( - (item) => item?.majorVersion != null || item?.minorVersion != null - ) - ) { - setShowFileItems(true); - } else if ( - processVersion?.majorVersion != null || - processVersion?.minorVersion != null - ) { - setShowFileItems(true); - } else { - setShowFileItems(false); - } - }, [importError, fileItems]); + useEffect(() => { + const fileItemsHasVersion = + fileItems && Object.values(fileItems).some(hasVersion); + const processVersionHasVersion = hasVersion(processVersion); + if (fileItemsHasVersion || processVersionHasVersion) { + setShowFileItems(true); + } else { + setShowFileItems(false); + } + }, [importError, fileItems, processVersion]); useEffect(() => { if (!showModal) { diff --git a/forms-flow-nav/src/sidenav/Sidebar.jsx b/forms-flow-nav/src/sidenav/Sidebar.jsx index bb4d87cf..0e2544c8 100644 --- a/forms-flow-nav/src/sidenav/Sidebar.jsx +++ b/forms-flow-nav/src/sidenav/Sidebar.jsx @@ -402,8 +402,8 @@ const Sidebar = React.memo(({ props, sidenavHeight="100%" }) => { }); Sidebar.propTypes = { - subscribe: PropTypes.func.isRequired, - getKcInstance: PropTypes.func.isRequired, + subscribe: PropTypes.func, + getKcInstance: PropTypes.func, publish: PropTypes.func, sidenavHeight: PropTypes.string, };