fix: email not always loading while viewing auth collections

This commit is contained in:
James
2022-07-25 16:29:20 -04:00
parent 9589f0798f
commit 36e9acc637
3 changed files with 4 additions and 4 deletions

View File

@@ -42,7 +42,6 @@ const Form: React.FC<Props> = (props) => {
initialState, // fully formed initial field state
initialData, // values only, paths are required as key - form should build initial state as convenience
waitForAutocomplete,
log,
} = props;
const history = useHistory();

View File

@@ -38,7 +38,7 @@ const useField = <T extends unknown>(options: Options): FieldType<T> => {
const initialValue = field?.initialValue as T;
const [internalValue, setInternalValue] = useState(field?.value as T);
const [internalValue, setInternalValue] = useState(() => field?.value as T);
const [internallyValid, setInternallyValid] = useState<boolean>(undefined);
// Debounce internal values to update form state only every 60ms

View File

@@ -13,6 +13,7 @@ import { useLocale } from '../../../utilities/Locale';
import { IndexProps } from './types';
import { StepNavItem } from '../../../elements/StepNav/types';
import { useDocumentInfo } from '../../../utilities/DocumentInfo';
import { Fields } from '../../../forms/Form/types';
const EditView: React.FC<IndexProps> = (props) => {
const { collection: incomingCollection, isEditing } = props;
@@ -41,7 +42,7 @@ const EditView: React.FC<IndexProps> = (props) => {
const { state: locationState } = useLocation();
const history = useHistory();
const { setStepNav } = useStepNav();
const [initialState, setInitialState] = useState({});
const [initialState, setInitialState] = useState<Fields>();
const { permissions, user } = useAuth();
const { getVersions, preferences } = useDocumentInfo();
@@ -123,7 +124,7 @@ const EditView: React.FC<IndexProps> = (props) => {
DefaultComponent={DefaultEdit}
CustomComponent={CustomEdit}
componentProps={{
isLoading: isLoadingDocument || !preferences,
isLoading: !initialState || !preferences,
data: dataToRender,
collection,
permissions: collectionPermissions,