fix: move dev account in useEffect
This commit is contained in:
@@ -3,7 +3,7 @@ import { AppState } from '@/ui_models/app_state';
|
|||||||
import { isDev } from '@/utils';
|
import { isDev } from '@/utils';
|
||||||
import { observer } from 'mobx-react-lite';
|
import { observer } from 'mobx-react-lite';
|
||||||
import { FunctionComponent } from 'preact';
|
import { FunctionComponent } from 'preact';
|
||||||
import { useState } from 'preact/hooks';
|
import { useEffect, useState } from 'preact/hooks';
|
||||||
import { Checkbox } from '../Checkbox';
|
import { Checkbox } from '../Checkbox';
|
||||||
import { Icon } from '../Icon';
|
import { Icon } from '../Icon';
|
||||||
import { InputWithIcon } from '../InputWithIcon';
|
import { InputWithIcon } from '../InputWithIcon';
|
||||||
@@ -20,11 +20,15 @@ export const AdvancedOptions: FunctionComponent<Props> = observer(
|
|||||||
appState.accountMenu;
|
appState.accountMenu;
|
||||||
const [showAdvanced, setShowAdvanced] = useState(false);
|
const [showAdvanced, setShowAdvanced] = useState(false);
|
||||||
|
|
||||||
if (isDev && window._devAccountServer) {
|
useEffect(() => {
|
||||||
setEnableServerOption(true);
|
if (isDev && window._devAccountServer) {
|
||||||
setServer(window._devAccountServer);
|
setEnableServerOption(true);
|
||||||
application.setCustomHost(window._devAccountServer);
|
setServer(window._devAccountServer);
|
||||||
}
|
application.setCustomHost(window._devAccountServer);
|
||||||
|
}
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
const handleServerOptionChange = (e: Event) => {
|
const handleServerOptionChange = (e: Event) => {
|
||||||
if (e.target instanceof HTMLInputElement) {
|
if (e.target instanceof HTMLInputElement) {
|
||||||
|
|||||||
@@ -33,15 +33,14 @@ export const SignInPane: FunctionComponent<Props> = observer(
|
|||||||
const emailInputRef = useRef<HTMLInputElement>(null);
|
const emailInputRef = useRef<HTMLInputElement>(null);
|
||||||
const passwordInputRef = useRef<HTMLInputElement>(null);
|
const passwordInputRef = useRef<HTMLInputElement>(null);
|
||||||
|
|
||||||
if (isDev && window._devAccountEmail) {
|
|
||||||
setEmail(window._devAccountEmail);
|
|
||||||
setPassword(window._devAccountPassword as string);
|
|
||||||
}
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (emailInputRef?.current) {
|
if (emailInputRef?.current) {
|
||||||
emailInputRef.current?.focus();
|
emailInputRef.current?.focus();
|
||||||
}
|
}
|
||||||
|
if (isDev && window._devAccountEmail) {
|
||||||
|
setEmail(window._devAccountEmail);
|
||||||
|
setPassword(window._devAccountPassword as string);
|
||||||
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const resetInvalid = () => {
|
const resetInvalid = () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user