Loaded state save
This commit is contained in:
@@ -59,7 +59,7 @@ const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, setLoadingState })
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!simBrief) return;
|
||||
if (!simBrief || GSXActive()) return;
|
||||
|
||||
setSBInFlight(true);
|
||||
|
||||
@@ -80,7 +80,7 @@ const SBEntryF: FC<SBEntryProps> = ({ WASMData, loadingState, setLoadingState })
|
||||
|
||||
setFuel(parseFloat((SBResponse.message as SimBrief).fuel as unknown as string) ?? 0);
|
||||
setSBInFlight(false);
|
||||
}, [simBrief]);
|
||||
}, [simBrief, GSXActive()]);
|
||||
|
||||
useEffect(
|
||||
() =>
|
||||
|
||||
@@ -59,7 +59,7 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, setLoadingState
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!simBrief) return;
|
||||
if (!simBrief || GSXActive()) return;
|
||||
|
||||
setSBInFlight(true);
|
||||
|
||||
@@ -80,7 +80,7 @@ const SBEntryPax: FC<SBEntryProps> = ({ WASMData, loadingState, setLoadingState
|
||||
|
||||
setFuel(parseFloat((SBResponse.message as SimBrief).fuel as unknown as string) ?? 0);
|
||||
setSBInFlight(false);
|
||||
}, [simBrief]);
|
||||
}, [simBrief, GSXActive()]);
|
||||
|
||||
useEffect(
|
||||
() =>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { FC, useState } from 'react';
|
||||
import { FC, useEffect, useState } from 'react';
|
||||
import { GSX_SERVICE_CALLED, GSX_SERVICE_FINISHED } from '../../constants';
|
||||
import { LoadingState } from '../../types/general';
|
||||
import { WASMDataPax } from '../../types/WASMData';
|
||||
@@ -84,6 +84,10 @@ const Pax: FC<PaxProps> = ({ WASMData, username }) => {
|
||||
];
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setLoadingState(WASMData.loaded ? 'loaded' : 'preview');
|
||||
}, [WASMData.loaded]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Profile
|
||||
|
||||
@@ -6,6 +6,7 @@ interface WASMData {
|
||||
ZFW: number;
|
||||
GW: number;
|
||||
};
|
||||
loaded: boolean;
|
||||
}
|
||||
|
||||
export interface WASMDataPax extends WASMData {
|
||||
|
||||
Reference in New Issue
Block a user