Autosave indicator #891
-
An option on the form to add an indicator as to the status of the autosave. I was able to achieve anyways but it would be a nice feature. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @bmartin1134 and thanks for the suggestion. While I don't think there's a need for it in the core themes (what loader to show, maybe you'd need text there, whether it's at the top or the bottom, is the form disabled while it's saving, etc.), I agree that it may be a good example in our docs. Here's a quick example of how it can be used: import React from 'react';
import { useForm } from 'uniforms';
enum FormState {
Error,
Idle,
Submitting,
Validating,
}
function useFormState() {
const uniforms = useForm();
return uniforms.error
? FormState.Error
: uniforms.submitting
? FormState.Submitting
: uniforms.validating
? FormState.Validating
: FormState.Idle;
}
function FormState() {
const state = useFormState();
return <div>{`Current form state is: ${state}`}</div>;
} |
Beta Was this translation helpful? Give feedback.
Hi @bmartin1134 and thanks for the suggestion. While I don't think there's a need for it in the core themes (what loader to show, maybe you'd need text there, whether it's at the top or the bottom, is the form disabled while it's saving, etc.), I agree that it may be a good example in our docs.
Here's a quick example of how it can be used: