fix: email not always loading while viewing auth collections
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user