preventing form updates when settings dialog is open
This commit is contained in:
parent
e8cc509915
commit
ffd5e0a769
3 changed files with 13 additions and 5 deletions
|
|
@ -133,6 +133,7 @@ export default function InteractionSettings(props: Props) {
|
|||
const prevInitialInteraction = usePrevious(initialInteraction);
|
||||
const prevComponents = usePrevious(components);
|
||||
const prevInitialComponent = usePrevious(initialComponent);
|
||||
const prevIsDialogOpen = usePrevious(isDialogOpen);
|
||||
const classes = useStyles();
|
||||
const [{ user, as }] = useGlobalState();
|
||||
const interactionsAPI = useInteractionsAPI();
|
||||
|
|
@ -232,10 +233,12 @@ export default function InteractionSettings(props: Props) {
|
|||
if (user && user.settings.timezone) {
|
||||
setTimezone(user.settings.timezone);
|
||||
}
|
||||
if (isDialogOpen && prevIsDialogOpen) return;
|
||||
if (
|
||||
prevInitialInteraction !== initialInteraction ||
|
||||
(prevComponents && prevComponents.length !== components.length) ||
|
||||
getComponentIDString(prevInitialComponent) !== getComponentIDString(initialComponent)
|
||||
getComponentIDString(prevInitialComponent) !== getComponentIDString(initialComponent) ||
|
||||
isDialogOpen !== prevIsDialogOpen
|
||||
) {
|
||||
setDefaultState();
|
||||
}
|
||||
|
|
@ -247,7 +250,9 @@ export default function InteractionSettings(props: Props) {
|
|||
prevInitialComponent,
|
||||
prevInitialInteraction,
|
||||
setDefaultState,
|
||||
user
|
||||
user,
|
||||
isDialogOpen,
|
||||
prevIsDialogOpen
|
||||
]);
|
||||
|
||||
const getAvailableSinks = () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue